Skip to content Skip to sidebar Skip to footer

Oracle Locking With Select...for Update Of

I'm selecting from tables FOO and BAR. I'd like to lock the records of FOO which are being returned, but I don't want the records of BAR to be locked. cursor c_foobar is select f

Solution 1:

From the 10G PL/SQL documentation:

When querying multiple tables, you can use the FOR UPDATE clause to confine row locking to particular tables. Rows in a table are locked only if the FOR UPDATE OF clause refers to a column in that table. For example, the following query locks rows in the employees table but not in the departments table:

DECLARECURSOR c1 ISSELECT last_name, department_name FROM employees, departments
    WHERE employees.department_id = departments.department_id 
          AND job_id ='SA_MAN'FORUPDATEOF salary;

Post a Comment for "Oracle Locking With Select...for Update Of"