>  기사  >  데이터 베이스  >  오라클 커서를 닫는 방법

오라클 커서를 닫는 방법

藏色散人
藏色散人원래의
2021-12-16 14:37:014651검색

oracle에서 커서를 닫는 방법: 1. "close mycursor;"와 같은 구문과 함께 close를 사용하여 닫습니다. 2. for 루프를 사용하고 자동으로 닫힐 때까지 기다립니다.

오라클 커서를 닫는 방법

이 문서의 운영 환경: Windows 7 시스템, Dell G3 컴퓨터, Oracle 11g 버전.

Oracle 커서를 닫는 방법은 무엇입니까?

1. 열려면 열기를 사용하고 닫으려면 닫기를 사용하세요

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 데이터베이스 학습 튜토리얼

위 내용은 오라클 커서를 닫는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.