Saturday, December 4, 2021
    HomeOracle DBA Tipsselect for update

    select for update

    sql tutorial, learn sql

    Hi friends,

    - Advertisement -

    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.

    - Advertisement -

    Generally, SELECT FOR UPDATE is the best solution for blocking lock problem. But it is not good for every time.

    A new Discussion Board of Oracle is established by Dbametrix for helping and give assistance for fresher Oracle job, how to earn money, and Oracle troubleshooting. Kindly join and share the knowledge.

    Thanks and regards,

    Expert Database Administration

    Online Oracle courses

    Latest IT news

    - Advertisement -
    - Advertisment -

    Most Popular

    Recent Comments