Tuesday, October 13, 2020

RDBMS PLSQL Program 44 program to generate before insert, update and delete row trigger on emp table

 SET Serveroutput ON

CREATE OR REPLACE TRIGGER display_salary_changes  

BEFORE DELETE OR INSERT OR UPDATE ON EMP  

FOR EACH ROW  

DECLARE  

   sal_diff number(10,2);  

BEGIN  

   sal_diff := :NEW.esalary  - :OLD.esalary;  

   dbms_output.put_line('Old salary: ' || :OLD.esalary);  

   dbms_output.put_line('New salary: ' || :NEW.esalary);  

   dbms_output.put_line('Salary difference: ' || sal_diff);  

END;  

/  

No comments:

Post a Comment

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