CREATE TRIGGER scott.salary_check
  BEFORE INSET OR UPDATE OF sal,job
  ON scott.emp

FOR EACH ROW
  DECLARE 
     minsal NUMBER;
     maxsal NUMBER;
  BEGIN
    SELECT minsal, maxsal FROM sal_guide
       INTO minsal, maxsal
    WHERE job=new.job

  IF (:new.sal<minsal OR :new.sal>maxsal)
    THEN raise_application_error(-99,'Fizetes ' ||:new.sal 
       ||'a megadott hatarokon kivuli e beosztashoz ' ||:new.job 
       ||'ehhez a beosztotthoz ' ||:new.ename);
  END IF;

END;