今天突然突发奇想让一个存储过程调用另外一个存储过程返回的游标,一个自己写的demo
内存储过程(v_id为传入的参数,result_cursor为传出的存储过程,放在cursor_package中)
create or replace procedure proc_innercursor(v_id in varchar, result_cursor
out cursor_package.type_cursor) is
v_name varchar2(10);
begin
open
result_cursor for select t.name from sys_resource t where t.id=v_id;
end
proc_innercursor;
定义包
create or replace package cursor_package as
type type_cursor is ref
cursor;
end;
外部调用的存储过程
create or replace procedure proc_testcursor (v_id in varchar2) is
result_cursor cursor_package.type_cursor;
type c_resor is record(
v_pid sys_resource.name%type 自定type
);
v_pidid
c_resor;
begin
proc_tesetcursor(v_id,result_cursor);
loop
fetch result_cursor into v_pidid;
exit when result_cursor%notfound;
dbms_output.put_line(v_pidid.v_pid);
end loop;
close
result_cursor;
end proc_testcursor;
Oracle存储过程调用存储过程,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/miceal/p/3746596.html