Oracle ref 动态游标

本文介绍了一个使用PL/SQL编写的存储过程示例,该过程定义了一个记录类型并使用游标来查询表格数据。通过绑定变量传递参数,并展示了如何逐行获取查询结果及输出。

create or replace procedure pro_cursor_type_V
 
as
t_tmp table3%rowtype;
type c_type is ref cursor;
cur c_type;
  v_taname varchar2(100);
begin
v_taname:='aa';
open cur for 'select * from table3 where taname=:a order by taid desc' --a只是绑定变量的占位符以 =: 符号进行绑定
  using v_taname;
  dbms_output.put_line('名称有');
  loop
  fetch cur into t_tmp;
  exit when cur%notfound;
  dbms_output.put_line('名称为'||t_tmp.taname||'日期为:'||t_tmp.indate);
  end loop;
end pro_cursor_type_V;

转载于:https://www.cnblogs.com/yuan-2012/archive/2012/06/21/2558166.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值