日期:2014-05-17 浏览次数:20887 次
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;
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; /
------解决方案--------------------
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.aiyiweb.com/oracle-develop/177537.html