[200分]程序块调用存储过程,展现游标的问题
create or replace package types
as
type p_cursor is ref cursor;---类型
end;
create or replace procedure query(v_sql varchar2,records out types.p_cursor)
as
begin
open records for all_sql;
end;
--通过程序块调用存储过程进行展现,但报"rs不是过程或尚未定义"错误
declare
allr number;
rs types.p_cursor;
begin
query('select * from dept',rs);
--如果只执行下面的输出,是正确的
dbms_output.put_line(rs%rowcount);
----执行下面报"rs不是过程或尚未定义"错误,为什么
for i in rs
loop
dbms_output.put_line(i.deptid||'---'||i.deptname);
end loop;
end;