FOR UPDATE OF
Allows you to lock columns of a table while a query is performed. Use the NOWAIT keyword to return immediately with a notification if unable to update due to a lock, rather than waiting for the lock to be removed.
Example:
DECLARE
CURSOR cur_move_emp(p_emp_loc employee.emp_loc%TYPE) IS
SELECT emp_id, dept_name
FROM employee, departments
WHERE emp_dept_id = dept_id
AND emp_loc = p_emp_loc
FOR UPDATE OF emp_loc NOWAIT; -- lock emp_loc column while we update,
BEGIN -- and return immediately if already locked
FOR cur_move_emp_var IN cur_move_emp('CA') LOOP
UPDATE employee
SET emp_loc = 'WA'
WHERE CURRENT OF cur_move_emp; -- using where current of instead of where <condition>
END LOOP;
COMMIT; -- remove the lock
END;