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. ...
Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.