oracle游標怎么關閉

oracle關閉游標的方法:1、使用close關閉,語法如“close mycursor;”;2、使用for循環,等待自行關閉即可。

oracle游標怎么關閉

本文操作環境:Windows7系統、Dell G3電腦、Oracle 11g版。

oracle游標怎么關閉?

1. 用open打開的,用close關閉

declare cursor?mycursor?is select?*?from?emp?for?update; myrecord?emp%rowtype; begin open?mycursor; loop fetch?mycursor?into?myrecord; exit?when?mycursor%notfound; if?(myrecord.sal=2000)?then update?emp set?sal=2001 where?current?of?mycursor; end?if; end?loop; close?mycursor; commit; end;

2. 用for 循環的,循環完了就自己關了

declare cursor?mycursor?is select?*?from?emp; begin for?i?in?mycursor loop dbms_output.put_line(i.job); end?loop; end;

相關推薦:oracle數據庫學習教程

以上就是

? 版權聲明
THE END
喜歡就支持一下吧
點贊5 分享