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

解决方案 »

  1.   


    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;
    /
      

  2.   

    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;