PL/SQL Triggers

Create Trigger

The PL/SQL triggers are procedures that are associated with tables, and are called
whenever an event occurs. The event statements may include INSERT, UPDATE or DELETE.

CREATE OR REPLACE TRIGGER my_trigger_name 

  {BEFORE | AFTER | INSTEAD OF} 

  {INSERT | UPDATE | DELETE} 

    [OF my_column_name] 

ON my_table_name 

 [REFERENCING OLD AS old NEW AS new] 

[FOR EACH ROW] 

WHEN condition

DECLARE

   -- declare statements 

BEGIN 

   -- sql statements 
   -- pl/sql statements  

EXCEPTION
  
   -- exception statements 

END;

Drop Trigger

DROP trigger trigger_name;

Alter Trigger

ALTER TRIGGER trigger_name COMPILE;

ALTER TRIGGER trigger_name RENAME TO new_trigger_name; 

ALTER TRIGGER trigger_name ENABLE; 

ALTER TABLE table_name ENABLE ALL TRIGGERS;

ALTER TRIGGER trigger_name DISABLE;  

ALTER TABLE table_name DISABLE ALL TRIGGERS; 

View Trigger

SELECT TRIGGER_NAME FROM USER_TRIGGERS;