码迷,mamicode.com
首页 > 其他好文 > 详细

sys_refcursor的使用方法实例

时间:2014-10-04 16:46:46      阅读:287      评论:0      收藏:0      [点我收藏+]

标签:blog   使用   ar   for   sp   div   2014   art   c   


--创建过程,參数为sys_refcursor,为out型
create or replace procedure aabbsys_refcursor(o out sys_refcursor) is
begin
  open o for select * from basplumain;
end;
---
--測试过程,使用aabbsys_refcursor传出的值
create or replace procedure aabb_test_sys_refcursor(return out int)is
type t_basplumain is table of basplumain%rowtype;
t_plu t_basplumain;
v sys_refcursor;
begin
  aabbsys_refcursor(v);
  fetch v bulk collect into t_plu;
  for i in 1..t_plu.count loop
    dbms_output.put_line(t_plu(i).pluname);
  end loop;
end;
---
--sqlplus測试脚本
--set serveroutput on
declare
v_return int default 0;
begin
  aabb_test_sys_refcursor(v_return);
end;


sys_refcursor的使用方法实例

标签:blog   使用   ar   for   sp   div   2014   art   c   

原文地址:http://www.cnblogs.com/hrhguanli/p/4005982.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!