How is a trigger compiled?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
How is a trigger compiled?
Rating:
A trigger is similar to a PL/SQL anonymous block, but with the additional :NEW and :OLD capabilities. However, their compilation is different. A PL/SQL anonymous block is compiled each time it is loaded into the memory. The compilation involves the following three stages:
A trigger, in contrast, is fully compiled when the CREATE TRIGGER statement is executed. The pcode is stored in the data dictionary. Hence, firing the trigger no longer requires the opening of a shared cursor to run the trigger action. Instead, the trigger is executed directly.
If errors occur during the compilation of a trigger, the trigger is still created. However, if a Data Manipulation Language (DML) statement fires this trigger, the DML statement fails. The SHOW ERRORS statement can be used within SQL*Plus or Enterprise Manager to see the compilation errors that occur during the creation of a trigger. The USER_ERRORS data dictionary view can also be queried to see the compilation errors.
Rating:
Was this information helpful?
Other articles
- What is a BEFORE trigger?
- What is the syntax for creating a package body?
- What is the REMOTE_DEPENDENCIES_MODE parameter?
- What are the guidelines for creating a package?
- What is the UTL_FILE Oracle supplied package?
