Oracle – PL-SQL – Trigger – After Insert OR Update OR Delete

We can create a trigger with multiple actions (i.e.  Insert or Update or Delete) here sharing an example of trigger in which we can handle three actions as insert, update and delete.

Example:

CREATE OR REPLACE TRIGGER EMPLOYEE_AI_AU_AD
AFTER INSERT OR UPDATE OR DELETE ON EMPLOYEE FOR EACH ROW

DECLARE
 V_Msg VARCHAR2(30) := 'Row Level Trigger Fired';
BEGIN
  IF INSERTING THEN
    dbms_output.put_line(V_Msg || ' After Inserting');
  ELSIF UPDATING THEN
    dbms_output.put_line(V_Msg || ' After Updating');
  ELSIF DELETING THEN
    dbms_output.put_line(V_Msg || ' After Deleting');
  END IF;
END EMPLOYEE_AI_AU_AD;

4 comments