A trigger is a feature provided by OceanBase Database. It is similar to stored procedures and functions, and includes a PL block that declares, executes, and handles exceptions.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
A trigger is executed based on specific events. You can specify whether the trigger is executed before or after the event, and whether it is triggered for a single event or for a specific row affected by the event.
A trigger is an independent object that automatically runs implicitly when an event occurs. A trigger cannot receive parameters. Here, an event refers to an INSERT, UPDATE, or DELETE operation performed on a database table.
Notice
OceanBase Database V2.2.7x and earlier versions support only row-level triggers on tables.
A simple trigger can be triggered at the following four times:
Before the execution of an event (a statement-level
BEFOREtrigger)After the execution of an event (a statement-level
AFTERtrigger)Before each row affected by the event (a row-level
BEFOREtrigger)After each row affected by the event (a row-level
AFTERtrigger)
A DML statement may trigger multiple simple triggers. The execution order is: statement-level BEFORE trigger -> row-level BEFORE trigger -> row-level AFTER trigger -> statement-level AFTER trigger.
The execution order of triggers of the same type is not determined. Currently, you cannot specify the execution order of triggers.
