Oracle Skip Locked

Source: Internet
Author: User
Tags dname

Oracle Skip Locked [html] Oracle Skip Locked Oracle 11g introduces skip locked. Skip Locked is used to Skip the rows that have been Locked by other query select statements in the query select statement, and only execute the rows that can obtain the lock. Select for update how to query a large number, then the select statement executed by other sessions at the same time may wait for the lock timeout and report the following error ORA-30006: resource busy; acquire with WAIT timeout expired if it is not time-out case, then the ORA-00054 resource busy and NOWAIT specified such as session1 will execute the following statement: SELECT * FROM dept WHERE deptno = 10 for update nowait; output: deptno dname loc ---------- -------------- ------------- 10 accounting new york session2 execute the following statement: SELECT * FROM dept WHERE deptno IN (10, 20) for update nowait; then the output: SELECT * FROM dept WHERE deptno IN () for update nowait error at line 1: ORA-00054: resource busy and acquire with NOWAIT specified because session1 has locked the row 10, and session2 requests to get the lock of less than 10, an error is returned. IN session2, we can use skip locked SELECT * FROM dept WHERE deptno IN () for update skip locked. At this time, the output is: deptno dname loc ---------- ------------ --------------- 20 research dallas skip locked skips the LOCKED rows and queries only the rows that are not LOCKED.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.