Oracle ref 动态游标

oracle 2012-06-22

Oracle ref 动态游标:

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;

相关推荐