Skip to main content
← PL/SQL Topics

Triggers

Explain the firing order of statement and row triggers for one DML statement

Trigger Firing Order for One Statement

ExplanationOracle Fusion / EBS · Technical · PL/SQLHigh confidenceGenerated

For each statement: BEFORE statement, then per row BEFORE row / row change / AFTER row, then AFTER statement.

How it works

A single INSERT/UPDATE/DELETE fires triggers in this sequence: (1) all BEFORE STATEMENT triggers once; (2) for every affected row — all BEFORE EACH ROW triggers, the row is modified and constraints checked, then all AFTER EACH ROW triggers; (3) all AFTER STATEMENT triggers once. A compound trigger slots its four sections into the same points. If any trigger raises an unhandled exception the whole statement rolls back. Zero-row statements still fire the statement-level triggers.

How it works
-- Given BEFORE STATEMENT, BEFORE ROW, AFTER ROW and AFTER STATEMENT
-- triggers on EMPLOYEES, this UPDATE touching 3 rows fires:
--   BEFORE STATEMENT      x1
--   BEFORE ROW / AFTER ROW  x3 (once per row)
--   AFTER STATEMENT       x1
UPDATE employees SET salary = salary * 1.02 WHERE department_id = 30;

Related questions

GroundingGenerated

Model-generated, grounded against the curated knowledge layer. Check specifics against your instance.

Have a follow-up, or a different question?

Continue in Ask Oracle AI