读书人

pl/sql怎么调用带有游标的存储过程(s

发布时间: 2012-07-31 12:33:46 作者: rapoo

pl/sql如何调用带有游标的存储过程(sql窗口的调用)
以下是我创建的存储过程:
create or replace procedure countinfo
(sno in char,out_val out sys_refcursor)
as
begin
open out_val for select * from countinfo
where s_no=sno;
end;
/
请问如何用sql窗口调用此存储过程?
并:
这样可以实现返回多个数据集吗?

[解决办法]
可以,给你个例子

SQL code
--创建与你类似的游标create or replace procedure deptp(deptno int,out_deptlist out sys_refcursor)isbegin    open out_deptlist for select * from dept where deptno>1;end;/--调用,懒得写了,和正常的游标一样调用declare     deptno int := 0;    deptlist sys_refcursor;begin    deptp(deptno,deptlist);    if deptlist%isopen then        --此处像正常游标一样调用就可以了        dbms_output.put_line('deptlist opened');        close deptlist;    end if;end;/
[解决办法]
一样的调用方法,直接使用Out参数返回的游标。
[解决办法]
探讨
以下是我创建的存储过程:
create or replace procedure countinfo
(sno in char,out_val out sys_refcursor)
as
begin
open out_val for select * from countinfo
where s_no=sno;
end;
/
请问如何用sql窗口调用此存储过程?
并:
……

[解决办法]
探讨
以下是我创建的存储过程:
create or replace procedure countinfo
(sno in char,out_val out sys_refcursor)
as
begin
open out_val for select * from countinfo
where s_no=sno;
end;
/
请问如何用sql窗口调用此存储过程?
并:
……

读书人网 >oracle

热点推荐