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;
转载请注明:IT运维空间 » Oracle » oracle游标怎么关闭?
继续浏览有关 oracle 的文章
发表评论