Triggerring_Events1.htm
Triggers in Oracle are a special type of stored programs usually maintained within a business  algorithms/logical modules, watching business operations.

A data base trigger is basically a PL/SQL script, to be executed when the data in a table are modified. It resembles an event which is enforced by an internal security measure to avoid misappropriations that can surface during a business transaction.

Usually triggers are invoked during DML ( DELETE, INSERT OR UPDATE ), some DDL ( CREATE, ALTER OR DROP),  and Miscellaneous error from the server ends. 

 

Advantages Of Using Triggers:
  • Enforcing Security policy and referential integrity.
  • Preventing invalid transaction and automated Rollback operations.
  • Syncing data/table between local and head-office tables
  • Complex business validation rules
  • And So on.

A database trigger can't call any stored procedure or function that contains COMIT, ROLLACK OR SAVEPOINT

Types of Triggers : Depending upon, how and when a trigger is fired, it may be classified as :


Statement-level trigger
Row-level trigger
Before triggers
After triggers

Original Emp Table:

Below is an operation, on a copy of original table "emp".

Updating emp_copy1 table:

Results: