How many rows are inserted into the AUDIT_TABLE?

Examine this code:
CREATE OR REPLACE TRIGGER update_emp
AFTER UPDATE ON emp
BEGIN
INSERT INTO audit_table (who, dated)
VALUES (USER, SYSDATE);
END;
You issue an UPDATE command in the EMP table that results in changing 10 rows.
How many rows are inserted into the AUDIT_TABLE?

Examine this code:
CREATE OR REPLACE TRIGGER update_emp
AFTER UPDATE ON emp
BEGIN
INSERT INTO audit_table (who, dated)
VALUES (USER, SYSDATE);
END;
You issue an UPDATE command in the EMP table that results in changing 10 rows.
How many rows are inserted into the AUDIT_TABLE?

A.
1

B.
10

C.
None

D.
A value equal to the number of rows in the EMP table.

Explanation:
Since the Trigger Type is not specified this Trigger defaults to a FOR EACH STATEMENT Trigger.
FOR EACH STATEMENT fire once for the triggering event, therefore one record will be inserted
into the audit_table.
Incorrect Answers:
B: If this was a FOR EACH ROW Trigger 10 rows would be inserted into the audit_table.
C: This trigger will fire & result in 1 record inserted into the audit_table
D: If all records were updated and the Trigger was a FOR EACH ROW Level Trigger then this
would be the correct Response



Leave a Reply 0

Your email address will not be published. Required fields are marked *