Oracle triggers if inserting updating
Triggers make understanding an existing system hard. During a code review, triggers are typically not even looked at in the context of the code being reviewed. The trigger is like a subroutine that is called over and over again.
A trigger is just like a subroutine , but most people consider triggers part of the DDL.
UTL_MAIL, UTL_SMTP, and UTL_TCP all suffer from the same problem: if the transaction that caused the trigger to fire rolls back, they’ll have performed operations that cannot be rolled back.
So, for anyone who writes triggers, the first rule of trigger coding is, “Do not perform any operation that cannot be rolled back.” Consider what happens if your trigger fires—the code executes—but the transaction rolls back.
This is perhaps the most frequent error made in the use of triggers—performing an operation that cannot be rolled back.
(Note that you do not need to perform the rollback yourself to have a rollback happen.
But dealing with incorrect implementation of triggers is another thing.And just as you would not review a CREATE TABLE statement while reviewing a package implementation, most people do not review the hidden code in a trigger.Incorrect Implementations The first reason I have for disliking triggers (the long-term maintenance headache) is merely an “I find them a pain in the neck” reason.Far too often, just anyone will create a trigger, without understanding the ramifications of doing so.For example, can you immediately see the huge bug in this trigger?
As part of normal processing, Oracle Database rolls back updates, deletes, and merges all the time without telling you that it has done so.