select for update

Database

select for update 문

Select for update 한 트랜잭션 내에서 나중에 변경할 목적으로 데이터를 읽을 때 사용한다. 기본적으로 실행하면 조회할 데이터의 Lock을 얻지 못할 경우 얻을 때까지 무작정 기다린다. 선택된 레코드들에 대해 베타적인 Lock을 커밋할 때까지 적용한다. 데이터의 일관성을 보장하기 위해 사용한다. 예시 declare l_sal number; begin select sal into l_sal from emp where empno = 7900 for update; ... update emp set sal = l_sal + 100 where empno = 7900; commit; end; nowait select for update 뒤에 nowait를 지정하면 select할 데이터의 Lock을 얻을 ..

xlwdn98767
'select for update' 태그의 글 목록