A trigger is a special type of procedure attached to a table column. The trigger goes into effect when a user changes the table with an insert, update, or delete command. The trigger executes immediately after the data modification statements are completed. Because triggers are more versatile than rules and referential integrity constraints, they are often used to:
Enforce referential integrity.
Cascade changes through related tables in a database, such as deleting a record.
Enforce restrictions that are more complex than those defined with rules. Unlike rules, triggers can reference columns or database objects.
Perform “what if” analyses, such as comparing a table before and after a data modification, and performing an action based on the results of the comparison.
Only the owner of an object can create a trigger on it. However, a trigger can modify an object owned by another user. If a trigger activates a trigger on another object, the owner of the first trigger must have privileges on the target object.