Creating Triggers
A trigger is a PROCEDURE that is invoked when an event occurs on a specified table. Trigger events can perform database manipulation language (DML) commands (such as INSERT, UPDATE, and DELETE) on the specified database tables. The action that occurs is based on the PL/SQL code used when the trigger was created. Triggers are fired implicitly by the database server when an event occurs on the trigger table, regardless of who the user is. Some of the uses for triggers are as follows:
Data manipulation
Referential integrity enforcement
Database auditing and monitoring
Business rules enforcement
Note
Triggers are not currently supported by MySQL.
Figure 20.2 illustrates a trigger. First, the user issues a transaction to the database. ...
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