Wednesday, March 21, 2012

What are PL/SQL Triggers



PL/SQL Triggers

A trigger is a PL/SQL block which will run automatically whenever an event occurs. PL/SQL block may be associated with a table, a view or to a database. OR simply, A trigger is a procedure to be run automatically when it is launched on the table associated with a command to the insert, update, or delete.

The general syntax is :


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

No comments:

Post a Comment