PolarDB databases compatible with Oracle support both row-level and statement-level triggers. A row-level trigger fires once for each row that is affected by a triggering event. For example, if deletion is defined as a triggering event on a table and a single DELETE statement is executed to delete five rows from the table, then the trigger will be fired five times, once for each row.

In contrast, a statement-level trigger is fired once for each triggering statement regardless of the number of rows affected by the triggering event. In the preceding example, a single DELETE statement deletes five rows, and a statement-level trigger will be fired only once.

For statement-level triggers, the sequence of actions can be defined. The sequence refers to whether the trigger code block is executed before or after the triggering statement itself. For row-level triggers, before or after each row is affected by the triggering statement.

In a before row-level trigger, the trigger code block is executed before the triggering action is carried out on each affected row. In a before statement-level trigger, the trigger code block is executed before the action of the triggering statement is carried out.

In an after row-level trigger, the trigger code block is executed after the triggering action is carried out on each affected row. In an after statement-level trigger, the trigger code block is executed after the action of the triggering statement is carried out.