Hi friends,
Today we discuss SELECT FOR UPDATE characteristics.
By default, the Oracle RDBMS locks rows as they are changed by any updated statement. To lock all rows in the result set, use the for update clause in your select statement when you open the cursor, instead of when you change the data. Using the FOR UPDATE clause does not necessitate you to essentially construct changes to the data; it merely locks the rows when opening the cursor. These locks are released on the next commit or rollback. As always, these row locks don’t affect other select statements unless they, too, are FOR update. The FOR UPDATE clause is appended to the end of the SELECT statement and has the following syntax.
Command Syntax:
select from … for update [column reference] [NOWAIT];
Where column reference is a comma-delimited list of columns that appear in select clause. The NOWAIT keyword tells the RDBMS to not wait for other blocking locks to be released. The default is to wait forever, and it is more problematic.
Generally, SELECT FOR UPDATE is the best solution for blocking the lock problem. But it is not good every time.
A new Discussion Board of Oracle is established by Dbametrix for help and give assistance for fresher Oracle jobs, how to earn money, and Oracle troubleshooting. Kindly join and share your knowledge.
Thanks and regards,
Expert Database Administration
When you want to make a strong Oracle DBA career then you should be aware of database services and other database technology. Without having knowledge of Oracle internals, Oracle performance tuning, and skill of Oracle database troubleshooting you can’t be an Oracle DBA expert.
This expert DBA Team club blog always provides you latest technology news and database news to keep yourself up to date. You should need to be aware of Cloud database technology like DBaaS. All Oracle DBA tips are available in a single unique resource at our orageek. Meanwhile, we are also providing some sql tutorials for Oracle DBA. This is the part of Dbametrix Group and you would enjoy more advanced topics from our partner resource.