Oracle Database 11g: Program with PL/SQL — Question 58
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.)
Answer options
- 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.
Correct answer: A, D
Explanation
The correct answer is A and D because an after trigger is needed to ensure that the deletion has already occurred before counting the remaining rows, and a statement-level trigger is appropriate since the requirement is to act on the overall operation rather than individual rows. The other options are incorrect as a before trigger would fire before the deletion, which does not align with the requirement of counting remaining rows post-deletion, and a row-level trigger would not be efficient for this purpose.