温馨提示  2024年 6月我们已经停止开发者板块文章内容更新,谢谢来访。存档数据
知识 2023-08-27 25 次阅读

oracle游标怎么关闭

   

oracle关闭游标的方法 1. 使用close关闭,语法如“close mycursor;”; 2. 使用for循环,等待自行关闭即可。

本文操作环境windows7系统、dell g3电脑、oracle 11g版。

oracle游标怎么关闭?

1. 用open打开的,用close关闭

declarecursor mycursor isselect * from emp for update;myrecord emp%rowtype;beginopen mycursor;loopfetch mycursor into myrecord;exit when mycursor%notfound;if (myrecord.sal=2000) thenupdate empset sal=2001where current of mycursor;end if;end loop;close mycursor;commit;end;

2. 用for 循环的,循环完了就自己关了

declarecursor mycursor isselect * from emp;beginfor i in mycursorloopdbms,output.put,line(i.job);end loop;end;

相关推荐oracle数据库学习教程