当前位置: 代码迷 >> Oracle开发 >> oracle怎么执行某一个包里带有输出参数的存储过程
  详细解决方案

oracle怎么执行某一个包里带有输出参数的存储过程

热度:7   发布时间:2016-04-24 07:22:14.0
oracle如何执行某一个包里带有输出参数的存储过程啊
如题,
SQL code
create or replace package TaskByTime is        type mycursor is ref cursor;        procedure ProTaskByTime(ret_cursor out mycursor);end TaskByTime;--package体create or replace package body TaskByTime is          procedure ProTaskByTime(ret_cursor out mycursor) is           begin                   open ret_cursor for select * from fl_rent_contract;                    end ProTaskByTime;end TaskByTime;begin   mypack.myfunction(2);end;


------解决方案--------------------
SQL code
create or replace package TaskByTime is        type mycursor is ref cursor;        procedure ProTaskByTime(ret_cursor out mycursor);end TaskByTime;/--package体create or replace package body TaskByTime is          procedure ProTaskByTime(ret_cursor out mycursor) is           begin                   open ret_cursor for select * from fl_rent_contract;                    end ProTaskByTime;end TaskByTime;/set serveroutput on;declare     v_rec fl_rent_contract%rowtype;--手动改成    v_cur TaskByTime.mycursor;begin     TaskByTime.ProTaskByTime(v_cur);    loop        fetch v_cur into v_rec;        exit when v_cur%notfound;        dbms_output.put_line(v_rec.你的列);    end loop;end;/
------解决方案--------------------
SQL code
declare  rec fl_rent_contract%rowtype;  cur TaskByTime.mycursor;begin  TaskByTime.ProTaskByTime(cur);  loop    fetch cur into rec;    exit when cur%notfound;--    dbms_output.put_line(rec.id);  end loop;end;
代码迷推荐解决方案:oracle存储过程,http://www.daimami.com/search?q=177537
  相关解决方案