Your browser does not support JavaScript. This help page requires JavaScript to render correctly. About Trigger Compilation and Dependencies
Skip Headers
Previous
Previous
 
Next
Next

About Trigger Compilation and Dependencies

Running a CREATE TRIGGER statement compiles the trigger being created. If this compilation causes an error, the CREATE TRIGGER statement fails. To see the compilation errors, run this statement:

SELECT * FROM USER_ERRORS WHERE TYPE = 'TRIGGER';

Compiled triggers depend on the schema objects on which they are defined. For example, NEW_EVALUATION_TRIGGER depends on the EVALUATIONS table:

CREATE OR REPLACE
TRIGGER NEW_EVALUATION_TRIGGER
BEFORE INSERT ON EVALUATIONS
FOR EACH ROW
BEGIN
  :NEW.evaluation_id := evaluations_seq.NEXTVAL;
END;

To see the schema objects on which triggers depend, run this statement:

SELECT * FROM ALL_DEPENDENCIES WHERE TYPE = 'TRIGGER';

If an object on which a trigger depends is dropped, or changed such that there is a mismatch between the trigger and the object, then the trigger is invalidated. The next time the trigger is invoked, it is recompiled. To recompile a trigger immediately, run the ALTER TRIGGER statement with the COMPILE clause. For example:

ALTER TRIGGER NEW_EVALUATION_TRIGGER COMPILE;

Related Topics

Oracle Database PL/SQL Language Reference

Using Triggers