用函数实现如下:
SQL> create or replace type myobjectype as object (x int,y date,z varchar2(50));
2 /
Type created.
SQL> create or replace type mytabletype as table of myobjectype
2 /
Type created.
--创建可以返回纪录集的函数(不传入表名参数)
SQL> create or replace function testrerecordnotabname (tableid in number)
2 return mytabletype
3 as
4 l_data mytabletype :=mytabletype();
5 begin
6 for i in (select * from a where id>=tableid) loop
7 l_data.extend;
8 l_data(l_data.count) := myobjectype(i.id,i.doctime,i.name);
9 exit when i.id = 62;
10 end loop;
11 return l_data;
12 end;
13 /
Function created.
SQL> create or replace type myobjectype as object (x int,y date,z varchar2(50));
2 /
Type created.
SQL> create or replace type mytabletype as table of myobjectype
2 /
Type created.
--创建可以返回纪录集的函数(不传入表名参数)
SQL> create or replace function testrerecordnotabname (tableid in number)
2 return mytabletype
3 as
4 l_data mytabletype :=mytabletype();
5 begin
6 for i in (select * from a where id>=tableid) loop
7 l_data.extend;
8 l_data(l_data.count) := myobjectype(i.id,i.doctime,i.name);
9 exit when i.id = 62;
10 end loop;
11 return l_data;
12 end;
13 /
Function created.
(v_ckdh in number,
v_MC out REC_MC )
as
begin for i in (select fun_id from userfun) loop
v_mc.extend;
v_mc.AA:= i.fun_id;
exit when i.fun_id is null;
end loop;
end;
/
还没测试,此类问题比较麻烦。(建义用游标)
(v_ckdh in number,
REF_MC out REC_MC )
as
begin
open ref_mc for 。就行了哈
end;