oracle游标怎么关闭
时间:2021-12-16 14:37
oracle关闭游标的方法:1、使用close关闭,语法如“close mycursor;”;2、使用for循环,等待自行关闭即可。 本文操作环境:Windows7系统、Dell G3电脑、Oracle 11g版。 oracle游标怎么关闭? 1. 用open打开的,用close关闭 2. 用for 循环的,循环完了就自己关了 相关推荐:oracle数据库学习教程 以上就是oracle游标怎么关闭的详细内容,更多请关注gxlsystem.com其它相关文章!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;
declare
cursor mycursor is
select * from emp;
begin
for i in mycursor
loop
dbms_output.put_line(i.job);
end loop;
end;