2 Day Developer > Using Triggers > Overview of Triggers
Overview of Triggers |
Previous |
Next |
A database trigger is a stored procedure associated with a database table, view, or event. The trigger can be called once, when some event occurs, or many times, once for each row affected by an INSERT
, UPDATE
, or DELETE
statement. The trigger can be called after the event, to record it, or take some follow-up action. The trigger can be called before the event, to prevent erroneous operations or fix new data so that it conforms to business rules. The executable part of a trigger can contain procedural statements and SQL data manipulation statements.
Triggers are created using the SQL CREATE
TRIGGER
statement. This statement can be used with Object Browser, SQL Script Editor, or SQL Command Line (SQL*Plus). The CREATE
(or CREATE
OR
REPLACE
) statement fails if any errors exist in the PL/SQL block.
This section contains the following topics: