解决方案 »

  1.   


    --存储过程
    create or replace procedure sql_test (unit int,po_return out sys_refcursor) is
    begin  
      open po_return for select * from test where id=unit; 
    end ; --调用
    declare  
      cur1 SYS_REFCURSOR; 
      rec test%rowtype;  
     begin  
     sql_test(1,cur1);  
     loop  
       fetch cur1 into rec;  
       exit when cur1%notfound;  
     dbms_output.put_line('----------------i :'||rec.id);  
     end loop;  
     close cur1;  
     end; 
      

  2.   


    --存储过程
    create or replace procedure sql_test (unit int,po_return out sys_refcursor) is
    begin  
      open po_return for select * from test where id=unit; 
    end ; --调用
    declare  
      cur1 SYS_REFCURSOR; 
      rec test%rowtype;  
     begin  
     sql_test(1,cur1);  
     loop  
       fetch cur1 into rec;  
       exit when cur1%notfound;  
     dbms_output.put_line('----------------i :'||rec.id);  
     end loop;  
     close cur1;  
     end; 

    带普通参数和游标好像没有冲突啊,用1楼的就行了,顶一下。
      

  3.   

    谢啦!
    --存储过程
    create or replace procedure sql_test (unit int,po_return out sys_refcursor) is
    begin  
      open po_return for select * from test where id=unit; 
    end ; --调用
    declare  
      cur1 SYS_REFCURSOR; 
      rec test%rowtype;  
     begin  
     sql_test(1,cur1);  
     loop  
       fetch cur1 into rec;  
       exit when cur1%notfound;  
     dbms_output.put_line('----------------i :'||rec.id);  
     end loop;  
     close cur1;  
     end; 

    带普通参数和游标好像没有冲突啊,用1楼的就行了,顶一下。
      

  4.   

    谢谢!半路出身 之前没搞清楚,a thousand thanks!--存储过程
    create or replace procedure sql_test (unit int,po_return out sys_refcursor) is
    begin  
      open po_return for select * from test where id=unit; 
    end ; --调用
    declare  
      cur1 SYS_REFCURSOR; 
      rec test%rowtype;  
     begin  
     sql_test(1,cur1);  
     loop  
       fetch cur1 into rec;  
       exit when cur1%notfound;  
     dbms_output.put_line('----------------i :'||rec.id);  
     end loop;  
     close cur1;  
     end;