经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 数据库/运维 » Oracle » 查看文章
Oracle游标的简易用法
来源:cnblogs  作者:又到了白色相簿的季节  时间:2019/8/23 8:42:45  对本文有异议
  1. 1 create or replace procedure NW_DelYW(iOPERATION_ID number,
  2. 2 sUserID varchar2) is
  3. 3 sCurDJBH yw_operation_link.djbh%type;
  4. 4 cursor table_yw(ywid yw_operation.id%type) is
  5. 5 select * from yw_operation_link t1 where t1.operation_id = ywid;
  6. 6 begin
  7. 7 for dr in table_yw(iOPERATION_ID) loop
  8. 8 sCurDJBH := dr.djbh;
  9. 9 --取得opercationid
  10. 10 /* select t1.operation_id
  11. 11 into sOperationID
  12. 12 from yw_operation_link t1
  13. 13 where t1.djbh = sCurDJBH;*/
  14. 14
  15. 15 --写日志
  16. 16 insert into log_zfywinfo
  17. 17 (DJBH,
  18. 18 DJDL,
  19. 19 DJXL,
  20. 20 DLMC,
  21. 21 XLMC,
  22. 22 SLR,
  23. 23 SLRID,
  24. 24 SQRXM,
  25. 25 FWZL,
  26. 26 ZFRQ,
  27. 27 ZFRID,
  28. 28 zfr)
  29. 29 select distinct sCurDJBH,
  30. 30 t4.id,
  31. 31 t3.id,
  32. 32 t4.name,
  33. 33 t3.name,
  34. 34 t1.slry,
  35. 35 t1.slryid,
  36. 36 t1.SQRXM,
  37. 37 t1.zl,
  38. 38 sysdate,
  39. 39 sUserID,
  40. 40 (select tt.name from pw_user tt where tt.id=sUserID)
  41. 41 from yw_operation t1
  42. 42 join yw_operation_link t2
  43. 43 on t2.operation_id = t1.ID
  44. 44 join BUSINESS_TYPE t3
  45. 45 on t3.id = t1.business_id
  46. 46 join BUSINESS_CLASS t4
  47. 47 on t4.id = t3.parent_id
  48. 48 where t1.ID = dr.operation_id;
  49. 49 exception
  50. 50 when others then
  51. 51 rollback;
  52. 52 dbms_output.put_line(sqlerrm);
  53. 53 end NW_DelYW;

Oracle使用cursor 游标循环添加删除更新。

原文链接:http://www.cnblogs.com/beiyuan324/p/11389912.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号