Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

plsql triggers

CREATE OR REPLACE TRIGGER display_salary_changes 
BEFORE DELETE OR INSERT OR UPDATE ON customers 
FOR EACH ROW 
WHEN (NEW.ID > 0) 
DECLARE 
   sal_diff number; 
BEGIN 
   sal_diff := :NEW.salary  - :OLD.salary; 
   dbms_output.put_line('Old salary: ' || :OLD.salary); 
   dbms_output.put_line('New salary: ' || :NEW.salary); 
   dbms_output.put_line('Salary difference: ' || sal_diff); 
END; 
/
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #plsql #triggers
ADD COMMENT
Topic
Name
1+6 =