(转)Oracle存储过程返回游标实例详解

有俩种方法
一种是声明系统游标,一种是声明自定义游标,然后后面操作一样,参数类型为 
in out 或out 
(1)声明个人系统游标.(推荐) 

代码如下:

create or replace p_temp_procedure
(
cur_arg out sys_refcursor; --方法1
)
begin
open cur_arg for select * from tablename;
end

调用 

代码如下:

Declare
cur_calling sys_refcursor;
begin
p_temp_procedure(cur_calling); --这样这个游标就有值了
for rec_next in cur_calling loop
....
end loop;
end;

猜你喜欢

转载自blog.csdn.net/zxl881203/article/details/88843355