Triggers

Triggers Management

You can register, deregister, start or stop a trigger instance through SQL statements, and you can also query all registered triggers through SQL statements.

Triggers have two states: STARTED and STOPPED. You can start or stop a trigger by executing START TRIGGER or STOP TRIGGER. Note that the triggers registered by the CREATE TRIGGER statement are STARTED by default.

Create Triggers

The following shows the SQL syntax of how to register a trigger.

CREATE TRIGGER <TRIGGER-NAME>
(BEFORE | AFTER) INSERT
ON <FULL-PATH>
AS <CLASSNAME>

You can also set any number of key-value pair attributes for the trigger through the WITH clause:

CREATE TRIGGER <TRIGGER-NAME>
(BEFORE | AFTER) INSERT
ON <FULL-PATH>
AS <CLASSNAME>
WITH (
  <KEY-1>=<VALUE-1>, 
  <KEY-2>=<VALUE-2>, 
  ...
)

Note that CLASSNAME, KEY and VALUE in key-value pair attributes need to be quoted in single or double quotes.

Drop Triggers

The following shows the SQL syntax of how to deregister a trigger.

DROP TRIGGER <TRIGGER-NAME>

Start Triggers

The following shows the SQL syntax of how to start a trigger.

START TRIGGER <TRIGGER-NAME>

Stop Triggers

The following shows the SQL syntax of how to stop a trigger.

STOP TRIGGER <TRIGGER-NAME>

Show All Registered Triggers

SHOW TRIGGERS