Home
Try YouTube in a new web browser!
Download Google Chrome

A trigger can be in either of two states:

Enabled . An enabled trigger executes its trigger body if a triggering statement is entered and the trigger restriction (if any) evaluates to TRUE . Disabled . A disabled trigger does not execute its trigger body, even if a triggering statement is entered and the trigger restriction (if any) evaluates to TRUE . By default, a trigger is created in enabled state. To create a trigger in disabled state, use the DISABLE clause of the CREATE TRIGGER statement. Data Access for Triggers. When a trigger is fired, the tables referenced in the trigger action might be currently undergoing changes by SQL statements in other users transactions. In all cases, the SQL statements running within triggers follow the common rules used for standalone SQL statements. In particular, if an uncommitted transaction has modified values that a trigger being fired either must read (query) or write (update), then the SQL statements in the body of the trigger being fired use the following guidelines: Queries see the current read-consistent materialized view of referenced tables and any data changed within the same transaction. Updates wait for existing data locks to be released before proceeding. Uses of Triggers. Triggers supplement the standard capabilities of your database to provide a highly customized database management system. For example, you can use triggers to: Automatically generate derived column values. Enforce referential integrity across nodes in a distributed database. Enforce complex business rules. Provide transparent event logging. Maintain synchronous table replicates. Gather statistics on table access. Modify table data when DML statements are issued against views.