A trigger is a feature provided in OceanBase Database. Similar to stored procedures and functions, a trigger includes PL blocks for declaration, execution, and exception handling.
A trigger is executed when a specific event occurs. You can specify whether a trigger fires before or after an event. You can also specify whether a trigger fires for a specific event or fires for a row of data affected by an event.
A trigger is an independent object that is automatically implicitly executed when a specific event occurs. A trigger does not accept parameters. The triggering event can be an INSERT, UPDATE, or DELETE operation on a database table.
Notice
OceanBase Database V2.2.7x and earlier versions support only row-level triggers on tables.
Simple triggers fire on the following four occasions:
A statement-level
BEFOREtrigger fires before the triggering event occurs.A statement-level
AFTERtrigger fires after the triggering event occurs.A row-level
BEFOREtrigger fires before each row is affected by the triggering event.A row-level
AFTERtrigger fires after each row is affected by the triggering event.
A DML statement may trigger multiple simple triggers, which are executed in the following order: statement-level BEFORE trigger > row-level BEFORE trigger > row-level AFTER trigger > statement-level AFTER trigger.
The execution order for triggers of the same type is random. Currently, you cannot specify the order.