oracle存储过程通过游标输出Sql结果集


create or replace procedure testcur(STATIONID IN VARCHAR2,out_result_cursor out sys_refcursor)
is
v_sql varchar(200);
begin

v_sql:='select a.stationid,a.boxid from RPT_TVMCASHBOX a
where a.stationid='||STATIONID;
open out_result_cursor for v_sql;

end;

---------------------------------------------------------------

declare

   c_result sys_refcursor;

   c c_result%type;

   arr  test_table%rowtypr;

begin

   testcur(c);

   loop

     fetch c into arr;

          dbms_output.put_line(arr.boxid);

       exit when c%notfound;

  end loop;

   close c;

end;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM