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.
A, C
Row level trigger will result in mutating table error
A,D
I made a typo
A, D
a,d
AD
D. E
NOT E ANY WAY
A before trigger will give the number of records before you delete. So E is not correct.
not E ANYWAY.
Dumbs said A,C but i don’t believe them
prefer AD
A, D
D is correct because if the trigger attempts to select or modify the table while the trigger has not completed (ie. table is in transition). then mutating trigger error occurs because the table is in middle of a transaction so it causes the trigger to mutate.
Because each record is being dml’ed one by one, it is mutating
I found a good article
https://decipherinfosys.wordpress.com/2009/06/22/mutating-tabletrigger-error-and-how-to-resolve-it/
Great article btw, indeed the answer is A and D.
A row level trigger will result in a mutating error.
Just comment the — FOR EACH ROW of the trigger and the trigger will fire correctly.
A,D
AD
AD