可以的,如decode()函数 SQL> create or replace procedure test1(rcursor out sys_refcursor) as 2 begin 3 open rcursor for 4 select decode(row_number() over(partition by deptno order by ename), 5 1, 6 deptno, 7 null) deptno, 8 t.ename 9 from scott.emp t; 10 end; 11 /Procedure created.SQL> var cur refcursor SQL> exec test1(:cur);
SQL> create or replace procedure test1(rcursor out sys_refcursor) as
2 begin
3 open rcursor for
4 select decode(row_number() over(partition by deptno order by ename),
5 1,
6 deptno,
7 null) deptno,
8 t.ename
9 from scott.emp t;
10 end;
11 /Procedure created.SQL> var cur refcursor
SQL> exec test1(:cur);
我的问题是这样:
在一个包体里,自定义Function 函数 Query(), 这个Query() 返回一个sys_refcursor 游标.
同时在这个包体里,还有一个Procedure DoPro() 存储过程,我想在这存储过程里 使用 Query()函数的返回游标,并使用loop循环取值.
请问这样可以么?