Saturday, 2 March 2013

Creating Trigger in SQL


CREATE [OR REPLACE ] TRIGGER trigger_name
 {BEFORE | AFTER | INSTEAD OF } 
 {INSERT [OR] | UPDATE [OR] | DELETE} 
 [OF col_name] 
 ON table_name 
 [REFERENCING OLD AS o NEW AS n] 
 [FOR EACH ROW] 
 WHEN (condition)  
 BEGIN 
   --- sql statements  
 END; 




NOTE :  If a trigger produces compilation errors, then it is still created, but it fails on execution.

               To delete or drop a trigger type DROP TRIGGER TRIGGER_NAME ;

No comments:

Post a Comment

There was an error in this gadget