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