This example invokes the SQL UDF common_value_expression from the WHEN clause of the definition of the row trigger trig_insert_after_update.
CREATE TRIGGER trig_insert_after_update AFTER UPDATE OF b1 ON t1 REFERENCING OLD AS OldRow NEW AS NewRow FOR EACH ROW WHEN (test.common_value_expression(OldRow.a1, NewRow.b1) >.10) INSERT INTO t2 VALUES (NewRow.a1, NewRow.b1, NewRow.c1);
The next example invokes the SQL UDF common_value_expression in the triggered statement of the row trigger trig_insert.
CREATE TRIGGER trig_insert AFTER INSERT ON t1 REFERENCING NEW AS n FOR EACH ROW ( INSERT INTO t2 VALUES (n.a1, test.common_value_expression(n.b2, 1), n.c1); );