不能这样用,只能通过引用游标来实现! 定义一个引用游标类型 type refcur_type is ref cursor; 在一个package中 然后再定一个相应的游标变量 v_refcur_type packageName.refcur_type ; 然后就可以直接打开这个游标变量了 open v_refcur_type for yoursql; 就可以直接进行操作了!
to lialin(阿林) 你的这个方法根本不行,我试了.过程返回记录集可以,但是,再程序中还使用记录集是不行的
to: bluelamb(bluelamb) 这不是可以吗?不知道你说的哪里不行!create or replace procedure p_test_refcur is v_refcur PKG_RefCursor.Refcursor; v_count integer; begin --prc_Test_refcursor(v_refcur); open v_refcur for 'select count(*) from t_pay_mode';
fetch v_refcur into v_count; dbms_output.put_line(v_count); --aa; end p_test_refcur; SQL> set serverout on SQL> exec p_test_refcur 0PL/SQL procedure successfully completed
定义一个引用游标类型 type refcur_type is ref cursor; 在一个package中
然后再定一个相应的游标变量 v_refcur_type packageName.refcur_type ;
然后就可以直接打开这个游标变量了
open v_refcur_type for yoursql;
就可以直接进行操作了!
你的这个方法根本不行,我试了.过程返回记录集可以,但是,再程序中还使用记录集是不行的
这不是可以吗?不知道你说的哪里不行!create or replace procedure p_test_refcur is
v_refcur PKG_RefCursor.Refcursor;
v_count integer;
begin --prc_Test_refcursor(v_refcur);
open v_refcur for 'select count(*) from t_pay_mode';
fetch v_refcur into v_count;
dbms_output.put_line(v_count);
--aa;
end p_test_refcur;
SQL> set serverout on
SQL> exec p_test_refcur
0PL/SQL procedure successfully completed