What are the guidelines for designing triggers?
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.
What are the guidelines for designing triggers?
Rating:
Oracle recommends using the following guidelines when designing triggers:
- Use triggers to ensure that when a specific operation is performed, related actions are performed.
- Do not define triggers that duplicate the features already built into Oracle. For example, do not define triggers to reject bad data if the same checking can be done through declarative integrity constraints.
- Limit the size of triggers. If the logic for a trigger requires more than sixty lines of PL/SQL code, it is better to include most of the code in a stored procedure and call the procedure from the trigger.
- Use triggers only for centralized, global operations that should be fired for the triggering statement, regardless of which user or database application issues the statement.
- Do not create recursive triggers. For example, creating an AFTER UPDATE statement trigger (on the Employees table) that itself issues an UPDATE statement on the Employees table causes the trigger to fire recursively until it has run out of memory.
- Use triggers on databases judiciously. They are executed for every user every time the event (on which the trigger is created) occurs.
Rating:
Was this information helpful?
Other articles
- What is the difference between a procedure and function?
- What is a row trigger?
- What is the syntax for creating a package specification?
- What is a one-time-only procedure?
- What is DBMS_SQL Oracle supplied package?