You want to create a trigger that fires whenever rows are deleted from the customer table and that
displays the number of rows remaining in the table.
Which two statements are correct about the trigger to be created for the above requirement?
(Choose two.)
A.
It should be an after trigger.
B.
It should be a before trigger.
C.
It should be a row-level trigger.
D.
It should be a statement-level trigger.
E.
It can be a before or an after trigger.
Explanation:
It should be “A” and “D”, not “C” because of ORA-04091 error in row level trigger.
A and C
check here :https://docs.oracle.com/cd/B28359_01/server.111/b28318/triggers.htm#CNCPT1677
A,D
a , d
http://www.dba-oracle.com/t_avoiding_mutating_table_error.htm
A,D
If we create a row level trigger, it will fire for every single row that is getting deleted. Instead we should create statement level trigger which will fire once the entire statement is executed.
A D
Each new release of the Oracle database reduces the impact of the mutating table error on triggers and they are much less of a problem with Oracle9i and above. If a trigger does result in a mutating table error, the only real option is to rewrite the trigger as a statement-level trigger.
Mutating table errors only impact row level triggers. But to use a statement level trigger, some data may need to be preserved from each row, to be used by the statement level trigger. This data can be stored in a PL/SQL collection or in a temporary table. A simple row level trigger that causes a mutating table error can result in a very complicated statement level trigger to achieve the needed result.
Here are some important items to remember about triggers.
On insert triggers have no :OLD values.
On delete triggers have no :NEW values.
Triggers do not commit transactions. If a transaction is rolled back, the data changed by the trigger is also rolled back.
Commits, rollbacks and save points are not allowed in the trigger body. A commit/rollback affects the entire transaction, it is all or none.
Unhandled exceptions in the trigger will cause a rollback of the entire transaction, not just the trigger.
If more than one trigger is defined on an event, the order in which they fire is not defined. If the triggers must fire in order, you must create one trigger that executes all the actions in the required order.
A trigger can cause other events to execute triggers.
A trigger can not change a table that it has read from. This is the mutating table error issue.
The fact that a trigger can cause other triggers to fire is an important item to remember. A trigger that causes other database events to execute triggers can cause the database crash. For example, the database can capture server errors by defining a trigger on the database server error event.
But if this trigger causes a server error, the database will spin in a loop, with each firing of the trigger causing the error, firing the trigger again, and again, and again. The only way to regain control of the database is to disable the trigger.
The time to study or visit the content material or web sites we’ve linked to beneath.
below you will find the link to some internet sites that we believe you should visit
always a major fan of linking to bloggers that I love but really don’t get quite a bit of link like from
The information and facts talked about within the post are a few of the most beneficial available
here are some links to internet sites that we link to mainly because we feel they are worth visiting
always a significant fan of linking to bloggers that I appreciate but really don’t get a great deal of link like from
check below, are some absolutely unrelated websites to ours, nonetheless, they’re most trustworthy sources that we use
Here are a few of the web pages we suggest for our visitors
that will be the finish of this report. Here you will discover some internet sites that we assume you will enjoy, just click the links over
The info talked about inside the write-up are some of the most beneficial obtainable
always a big fan of linking to bloggers that I really like but do not get a lot of link adore from
just beneath, are various completely not related websites to ours, even so, they are surely really worth going over
check below, are some completely unrelated internet websites to ours, however, they may be most trustworthy sources that we use
Here is a superb Weblog You might Locate Intriguing that we Encourage You
The data talked about inside the report are several of the most beneficial available
Every the moment in a though we pick out blogs that we study. Listed beneath are the most current internet sites that we opt for
just beneath, are numerous absolutely not associated web pages to ours, on the other hand, they’re surely really worth going over
Sites of interest we have a link to
that will be the end of this post. Right here you will find some web pages that we consider youll enjoy, just click the hyperlinks over
we prefer to honor many other net websites on the internet, even if they arent linked to us, by linking to them. Beneath are some webpages really worth checking out
The details mentioned within the post are a number of the most effective accessible