设为首页 加入收藏

TOP

oracle sys_refcursor语句
2014-11-24 02:08:17 来源: 作者: 【 】 浏览:0
Tags:oracle sys_refcursor 语句
oracle sys_refcursor语句
Ref_cursor代码 www.2cto.com
create or replace procedure testprodurce is
cursor c_row is
select * from fpkj;
ref_c_row sys_refcursor;
-- ref_c_row
kplsh varchar2(200);
kplx number;
begin
for tmp in c_row loop
dbms_output.put_line(tmp.kplsh);
end loop;
/*
execute immediate 'select kplsh,kplx from fpkj where kplx=:1'
into ref_c_row
using 2;
不能into到cursor,只能类似count(*)into到number类型中 www.2cto.com
*/
open ref_c_row for 'select kplsh,kplx from fpkj where kplx=:1'
using 2;
loop
fetch ref_c_row
into kplsh, kplx;
exit when ref_c_row%notfound;
dbms_output.put_line(kplsh || '---->' || kplx);
end loop;
close ref_c_row;
declare
ct_fpkj number;
begin
execute immediate 'select count(*) from fpkj where kplx=:1'
into ct_fpkj
using 2;
dbms_output.put_line(ct_fpkj);
end;
end testprodurce;
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇oracle游标cursor简单使用 下一篇Oracle Cursor介绍

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: