`
luogen33
  • 浏览: 81010 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

oracle plsql 游标

 
阅读更多
create or replace procedure test_proc is
  v_corpid corpinfo.corpid%type := '16000000001%';
  vv       corpinfo%rowtype;
  --定义游标
  cursor one is
    select * from corpinfo where corpinfo.corpid like v_corpid;
begin
  --遍历游标1
  open one;
  loop
    fetch one
      into vv;
    exit when one%notfound;
    dbms_output.put_line(vv.corpid || ' ' || vv.corpname || ' ' ||
                         vv.corpdesc || ' ' || vv.corpfeenumber);
  end loop;
  close one;
  dbms_output.put_line('-----------------------------------');
  --遍历游标2
  for oo in one loop
    dbms_output.put_line(oo.corpid || ' ' || oo.corpname || ' ' ||
                         oo.corpdesc || ' ' || oo.corpfeenumber);
  end loop;
  exception when others then
     dbms_output.put_line('DB Exception ..');
end test_proc;
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics