如题,
- 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