以下是我创建的存储过程:
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窗口调用此存储过程?
并:
这样可以实现返回多个数据集吗?
create or replace procedure deptp(
deptno int,out_deptlist out sys_refcursor
)
is
begin
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;
/
至于调用,在sql中调用,oracle的规定很死,想procedure在sql中不可能调用的!
只能调用function,对存储过程的参数也有要求,这个就不说了!
所以你应该用pl/sql命令调用就可以了
调用就太简单了,
定义两个变量,一个char,一个动态游标,传进去就可以了
至于调用,在sql中调用,oracle的规定很死,想procedure在sql中不可能调用的!
只能调用function,对存储过程的参数也有要求,这个就不说了!
所以你应该用pl/sql命令调用就可以了
调用就太简单了,
定义两个变量,一个char,一个动态游标,传进去就可以了