CREATE TRIGGER scott.emp_perm_ch
  BEFORE DELETE OR INSERT OR UPDATE
  ON scott.emp

DECLARE
  dummy INTEGER

BEGIN
  IF (TO_CHAR(SYSDATE,'DY')='SAT' OR
      TO_CHAR(SYSDATE,'DY')='SUN')
    THEN raise_application_error(-33,'Ne modositsd hetvegen!');
  END IF;

  SELECT count(*) INTO dummy
    FROM company_holidays
    WHERE day=TRUNC(SYSDATE);
   
  IF dummy>0
    THEN raise_application_error(-34,'Ne modositsd unnepnapon!');
  END IF;

  IF (TO_CHAR(SYSDATE,'HH24')<8 OR
      TO_CHAR(SYSDATE,'HH24')>=18)
    THEN raise_application_error(-36,'Ne modositsd munkaidoben!');
  END IF;

END;