-- min_hourly_wage2.sql

CREATE OR REPLACE TRIGGER minimum_hourly_wage
  BEFORE INSERT OR UPDATE OF pay_amount
      ON employee
     FOR EACH ROW
    WHEN (new.pay_type_code IN ('H', 'T') )
DECLARE
   min_wage NUMBER(9,2);
BEGIN
   SELECT minimum_wage INTO min_wage
     FROM pay_type WHERE pay_type_code = :new.pay_type_code;
   IF :new.pay_amount < min_wage THEN
      :new.pay_amount := min_wage;
   END IF;
END;
/
