Oracle - Describe the use of "for update of" in Oracle
Cursor. - April 30, 2009 at 20:00 PM by Amit Satpute
Describe the use of "for update of" in Oracle Cursor.
The CURSOR FOR UPDATE obtains a lock on a selected number of rows that have not
undergone a COMMIT yet, until a user is done with the transaction.
2 cursor cur_emp is
3 select id
4 from emp
5 for update of dept;
7 for r_cur_emp in cur_emp loop
8 if r_ cur_emp.dept = 'IT' then
9 update emp
10 set salary = salary + 1000
11 where current of cur_emp;
12 end if;
13 end loop;
In this example, we are increasing the salary of the employees from the IT
department by 1000 each.
Oracle DCL and TCL
Oracle DML commands
function, procedure, package