oracle关闭游标的方法:1、使用close关闭,语法如“close mycursor;”;2、使用for循环,等待自行关闭即可。
本文操作环境: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数据库学习教程
以上就是oracle游标怎么关闭的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号