After statement-level trigger v14
This example shows an after statement-level trigger. When an insert, update, or delete operation occurs on the emp
table, a row is added to the empauditlog
table recording the date, user, and action.
In the following sequence of commands, two rows are inserted into the emp
table using two INSERT
commands. One UPDATE
command updates the sal
and comm
columns of both rows. Then, one DELETE
command deletes both rows.
The contents of the empauditlog
table show how many times the trigger was fired:
- Once each for the two inserts
- Once for the update (even though two rows were changed)
- Once for the deletion (even though two rows were deleted)