Tuesday, 17 March 2015

TRIGGER FOR INSERT ERROR IN BUSINESS HOURS

TRIGGER FOR INSERT ERROR  :

CREATE OR REPLACE TRIGGER secure_emp2
BEFORE INSERT ON EMP66
BEGIN
IF (TO_CHAR(SYSDATE,'DY') IN ('TUE','SUN')) OR
(TO_CHAR(SYSDATE,'HH24:MI')
NOT BETWEEN '08:00' AND '9:00')
THEN RAISE_APPLICATION_ERROR (-20500,'You may
insert into EMPLOYEES table only
during business hours.');
END IF;
END;
/






THEN TRY INSERT INTO .........  THUMS UP ☺

No comments:

Post a Comment