Trigger 1 (learning notes), trigger (learning notes)
Syntax:
CREATE [or replace] TRIGGER trigger_name: CREATE a TRIGGER and set the TRIGGER name. If or replace is selected, the TRIGGER is replaced if it already exists.
[BEFOR | AFTER]: refers to the trigger day, BEFORC between operations, AFTER the operation is triggered
Instead of: Used to replace a trigger. The trigger type defined for view operations
INSERT | update of column name | DELETE, triggering event, which can be INSERT, UPDATE, DELETE, or partially UPDATE added to a data table
ON [Table Name | View | DATABASE | SCHEMA]: refers to the trigger object of a trigger. It can be a table, view, DATABASE, or mode (user)
REFERENCING [old as Mark] [new as Mark] [parent as Mark]: defines aliases for ": old", ": new", ": parent"
[For each row]: defines a ROW-Level Trigger. If this parameter is not specified, a table-Level Trigger is defined.
[FOLLOWS trigger name:] configure the execution sequence of multiple triggers
[DISABLE:] A trigger is enabled by default after it is created. You can use this option to DISABLE it.
[WHEN trigger condition]: triggers are executed WHEN the specified condition is met.
[DECLARE]: The subject declaration part of the trigger, which defines variables or cursors.
[PRAGMA AUTONOMOUS_TRANSACTION;] autonomous transaction statement
BEGIN: Main part of the program
END: the END tag of the trigger.
The trigger does not receive any listening parameters, and is automatically called only after a trigger event is generated.