Oracle7 Server Application Developer's Guide
Enabling and Disabling Triggers
A trigger can be in one of two distinct modes:
enabled | An enabled trigger executes its trigger body if a triggering statement is issued and the trigger restriction (if any) evaluates to TRUE. |
disabled | A disabled trigger does not execute its trigger body, even if a triggering statement is issued and the trigger restriction (if any) evaluates to TRUE. |
Disabling Triggers
You might temporarily disable a trigger if
- an object it references is not available
- you have to perform a large data load and want it to proceed quickly without firing triggers
By default, triggers are enabled when first created. Disable a trigger using the ALTER TRIGGER command with the DISABLE option. For example, to disable the trigger named REORDER of the INVENTORY table, enter the following statement:
ALTER TRIGGER reorder DISABLE;
All triggers associated with a table can be disabled with one statement using the ALTER TABLE command with the DISABLE clause and the ALL TRIGGERS option. For example, to disable all triggers defined for the INVENTORY table, enter the following statement:
ALTER TABLE inventory
DISABLE ALL TRIGGERS;
Enabling Triggers
By default, a trigger is automatically enabled when it is created; however, it can later be disabled. Once you have completed the task that required the trigger to be disabled, re-enable the trigger so it fires when appropriate.
Enable a disabled trigger using the ALTER TRIGGER command with the ENABLE option. To enable the disabled trigger named REORDER of the INVENTORY table, enter the following statement:
ALTER TRIGGER reorder ENABLE;
All triggers defined for a specific table can be enabled with one statement using the ALTER TABLE command with the ENABLE clause with the ALL TRIGGERS option. For example, to enable all triggers defined for the INVENTORY table, enter the following statement:
ALTER TABLE inventory
ENABLE ALL TRIGGERS;
Privileges Required to Enable and Disable Triggers
To enable or disable triggers using the ALTER TABLE command, you must either own the table, have the ALTER object privilege for the table, or have the ALTER ANY TABLE system privilege. To enable or disable triggers using the ALTER TRIGGER command, you must own the trigger or have the ALTER ANY TRIGGER system privilege.