Tuesday, October 13, 2020

RDBMS PLSQL Program 46 program to generate before insert,update and delete row trigger on emp table which will not allow changes in data before and after office hours using RAISE_APPLICATION_ERROR() function

 CREATE OR REPLACE TRIGGER Working_hrs

BEFORE INSERT OR UPDATE OR DELETE ON emp

DECLARE

WORKING_HOURS NUMBER(2);

BEGIN

WORKING_HOURS := TO_CHAR(SYSDATE,’HH24′);

IF WORKING_HOURS < 9 AND WORKING_HOURS > 17 THEN

RAISE_APPLICATION_ERROR(-20001,'Its not official working hours! Can not do operations on emp');

END IF;

END;

/

No comments:

Post a Comment

Thanks for showing your interest
I will shortly get back to you