-- salary_for_update.sql

DECLARE
  CURSOR emps IS
    SELECT pay_type_code, pay_amount
      FROM employee
     WHERE pay_type_code = 'S'
       FOR UPDATE;
  min_pay employee.pay_amount%TYPE;
BEGIN
   SELECT MIN(pay_amount)
     INTO min_pay
     FROM employee
    WHERE pay_type_code = 'S';
  FOR emp IN emps
  LOOP
    IF emp.pay_amount = min_pay THEN
      UPDATE employee
         SET pay_amount = pay_amount * 1.2
       WHERE CURRENT OF emps;
    END IF;
  END LOOP;
END;
/
