天天看点

oracle存储过程返回结果集

oracle存储过程返回结果集

http://www.2cto.com/database/201204/127180.html

oracle实现存储过程返回查询结果集合的方法

--实现存储过程返回查询结果集合的方法 ,以下代码来自网络整理 

http://topic.csdn.net/u/20090721/12/ba403739-3212-4016-83ec-2a7062f21081.html 

java代码  

--第一种方法  

create or replace package sysbasic  

as  www.2cto.com    

  type cc_cursor is ref cursor;  

end sysbasic;  

create or replace procedure getall(  

    c_cursor out sysbasic.cc_cursor  --光标结果  

)  

begin  

  open c_cursor for  

    select * from table1;  

end getall;   www.2cto.com   

--第二种方法  

create or replace procedure p_test(p_cur out sys_refcursor)as   

begin   

   open p_cur for select  * from emp;  

end p_test;  

在sqlplus界面:  

 sql> var r refcursor;  

 sql> exec p_test(:r);  

 sql> print r;  

 ================================================================

使用pl/sql进行调用查看见如下链接:

 http://blog.csdn.net/kimizhou_blog/article/details/39340851