打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
最佳游标例子
  1. create or replace procedure proccycle(p varchar2)   
  2. as    
  3. cursor c_postype is select pos_type, description from pos_type_tbl where rownum < 6;   
  4. v_postype varchar2(20);   
  5. v_description varchar2(50);   
  6. begin   
  7. open c_postype;   
  8.   if c_postype%found then   
  9.     dbms_output.put_line('found true');   
  10.   elsif c_postype%found = false then   
  11.     dbms_output.put_line('found false');   
  12.   else  
  13.     dbms_output.put_line('found null');   
  14.   end if;   
  15.   loop   
  16.    fetch c_postype into v_postype,v_description ;   
  17.    exit when c_postype%notfound;   
  18.    dbms_output.put_line('postype:'||v_postype||',description:'||v_description);   
  19.   end loop;   
  20.   close c_postype;   
  21. dbms_output.put_line('---loop end---');   
  22.   open c_postype;   
  23.     fetch c_postype into v_postype,v_description;   
  24.     while c_postype%found loop   
  25.       dbms_output.put_line('postype:'||v_postype||',description:'||v_description);   
  26.       fetch c_postype into v_postype,v_description ;   
  27.     end loop;   
  28.   
  29.   close c_postype;   
  30. dbms_output.put_line('---while end---');   
  31.   for v_pos in c_postype loop   
  32.     v_postype := v_pos.pos_type;   
  33.     v_description := v_pos.description;   
  34.     dbms_output.put_line('postype:'||v_postype||',description:'||v_description);   
  35.   end loop;   
  36.   dbms_output.put_line('---for end---');   
  37. end;  
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Oracle存储过程总结
Oracle游标使用大全(二)
Oracle笔记 九、PL/SQL 游标的使用
oracle使用六(游标管理)
几种游标的用法
Oracle Cursor的使用
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服