Professional Documents
Culture Documents
1]
Modified 16-APR-2009
Type BULLETIN
Status PUBLISHED
2. Trigger modes
---------------A trigger is in either of two distinct modes:
ENABLED : An enabled trigger executes its trigger action if:
- a triggering statement is issued and
- the trigger restriction (if any) evaluates to TRUE.
DISABLED: A disabled trigger does NOT execute its trigger action, even if:
- a triggering statement is issued and
- the trigger restriction (if any) would evaluate to TRUE.
The mode of a single trigger can be changed by:
ALTER TRIGGER my_trigger ENABLE;
ALTER TRIGGER my_trigger DISABLE;
The mode of all triggers associated with a table can be changed by:
ALTER TABLE my_table ENABLE ALL TRIGGERS;
ALTER TABLE my_table DISABLE ALL TRIGGERS;
A trigger can be explicitly compiled which eliminates the need for implicit
run-time recompilation. The trigger can be recompiled by:
ALTER TRIGGER my_trigger COMPILE;
3. Trigger types
---------------Oracle classifies four trigger types.
a. ROW triggers and STATEMENT triggers;
b. BEFORE and AFTER triggers (can apply to both statement and row triggers);
c. INSTEAD OF triggers;
d. System Events and User Events triggers.
4. What fires a trigger
----------------------A trigger can be fired upon the execution of a SQL statement or by an event:
a. SQL statements:
1) Data Manipulation Language (DML) statements that modify data in a table
(INSERT, UPDATE, or DELETE);
2) Data Definition Language (DDL) statements on any schema object
(CREATE, ALTER, or DROP).
b. Events:
1) database events (such as startup, and shutdown);
2) system events (such as a specific error message or any error message);
3) user events (such as logon, and logoff).
5. Single trigger timing
-----------------------This section describes the trigger timing of single triggers.