-- raise_mgr_pay3.sql

CREATE OR REPLACE PROCEDURE raise_mgr_pay AS
  over_max_pay EXCEPTION;
  PRAGMA EXCEPTION_INIT(over_max_pay, -20001);
BEGIN
  FOR s IN 1..7 LOOP
    BEGIN
      UPDATE employee
         SET pay_amount = pay_amount * 1.2
       WHERE id = (SELECT manager_id FROM store 
                    WHERE store_number = s);
    EXCEPTION
      WHEN over_max_pay THEN
        null;
    END;
  END LOOP;
END;
/
