Creating Custom Triggers
There is a certain degree of overlap between stored procedures (that is, functions) and triggers. Both operate as predefined code created with the CREATE FUNCTION statement. However, triggers are most often used as an automated response to some table-related event, not as an action directly called by a client application.
Triggers bind these functions to DELETE, UPDATE, or INSERT table events using the CREATE TRIGGER command. The client application has no direct knowledge of a trigger’s existence; it simply performs the requested action, which results in the server firing the appropriate trigger event.
Triggers are used for performing actions that pertain to the same table that is being accessed. Often they are used ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access