Trigger-Type Boolean Operator

The trigger-type Boolean operators of HCL OneDB™ can test at runtime whether the currently executing triggered action was triggered by the specified type of DML event. These operators take no operands.

Trigger-Type Boolean Operator

1 DELETING
1 INSERTING
1 SELECTING
1 UPDATING

These operators return TRUE ('t') if the triggering event of the currently executing trigger is the DML operation corresponding to the name of the operator, and they return FALSE ('f') otherwise. These operators are valid in IF statements, in CASE expressions, and in other contexts within an SPL trigger routines where a Boolean condition is valid.

For example, in the following statement fragment, the LET statement in the first THEN clause is executed only if the currently executing trigger was activated by an INSERT event, and the LET statement in the second THEN clause is executed only if the trigger was activated by a DELETE event:
IF (INSERTING = 't') THEN 
   LET square = NEW.X * NEW.X 
ELIF (DELETING = 't') THEN
   LET square = 0   

The SELECTING, DELETING, INSERTING, and UPDATING operators are valid only in trigger UDRs that are invoked in the FOR EACH ROW triggered action of a trigger on a table, or (for the DELETING, INSERTING, and UPDATING operators) of an INSTEAD OF trigger on a view. An error is issued if you attempt to use a trigger-type Boolean operator in any other context.

If a trigger routine is invoked by a Delete, Insert, or Update trigger that the MERGE statement has activated,
  • DELETING returns TRUE while MERGE is deleting a row from the target table.
  • INSERTING returns TRUE while MERGE is inserting a row into the target table.
  • UPDATING returns TRUE while MERGE is updating a row of the target table.