Compiling Triggers
Creating and Using Triggers
Using Triggers 5-9
When you need to disable all triggers on a particular table, you must use the statement
ALTER TABLE ... DISABLE ALL TRIGGERS
. To re-enable all the triggers for the
table, use the statement
ALTER TABLE ... ENABLE ALL TRIGGERS
.
shows how to temporarily disable all triggers that are defined on a
particular table.
Example 511 Disabling All Triggers on a Table
ALTER TABLE evaluations DISABLE ALL TRIGGERS;
shows how to re-enable all triggers that are defined on a particular
table.
Example 512 Enable All Triggers on a Table
ALTER TABLE evaluations ENABLE ALL TRIGGERS;
Compiling Triggers
A trigger is fully compiled when the
CREATE TRIGGER
statement is executed. If a
trigger compilation produces an error, the DML statement fails. To see the relevant
compilation errors, use the
USER_ERRORS
view.
Example 513 Displaying Trigger Compilation Errors
SELECT * FROM USER_ERRORS WHERE TYPE = 'TRIGGER';
Once a trigger is compiled, it creates dependencies on the underlying database objects,
and becomes invalid if these objects are either removed or modified so that there is a
mismatch between the trigger and the object. The invalidated triggers are recompiled
during their next invocation.
shows how to determine the dependencies triggers have on other
objects in the database.
Example 514 Displaying Trigger Dependencies
SELECT * FROM ALL_DEPENDENCIES WHERE TYPE = 'TRIGGER';
To re-compile a trigger manually, you must use the
ALTER TRIGGER ... COMPILE
statement, as shown in
Example 515 Displaying Trigger Compilation Errors
ALTER TRIGGER update_name_view_trigger COMPILE;
See Also:
Oracle Database PL/SQL Language Reference for details about
enabling triggers
Oracle Database PL/SQL Language Reference for details about
disabling triggers