我在数据库中创建了一个对象类型,并想在包中声明一个记录类型,以便使用引用游标循环提取数据,但这似乎不适用于对象类型。如何在不创建虚拟表的情况下实现这一点?我想使用如下所示的on可能会奏效,但我不知道该怎么做。type_object
type_record
%ROWTYPE
type_table
/* type_object has been created before */
declare
type type_table is table of type_object;
l_rec type_table%ROWTYPE; -- doesn't work
l_refcursor sys_refcursor;
begin
open l_refcursor for 'select * from mytable';
loop
fetch l_refcursor into l_rec;
exit when l_refcursor%notfound;
-- do something with l_rec
end loop;
close l_refcursor;
end;