I image that this is a documentation problem. The "words" around triggers seem to imply the ability to do actions "BEFORE" the INSERT/UPDATE/DELETE. For instance:
"Along with constraints, triggers can help enforce data integrity rules with actions such as cascading deletes or updates. Triggers can also perform a variety of functions such as issuing alerts, updating other tables, sending e-mail, and other useful actions."
Well, the CREATE TRIGGER command only allows AFTER as an option (even though the SYSTRIGGERS catalog uses "B" for before and "A" for after) and it won't allow a CALL statement to be processed. Seems to me that there aren't any ways to send an e-mail, issue alerts (no SIGNAL function either), or enforce integrity rules. How can you enforce integrity rules if invalid data comes in? I can't force a SIGNAL or error with the trigger, so this is useless for validating changes to the data.
In addition, there appears to be some logic regarding BEFORE triggers in Derby, but its not currently working.
CREATE TRIGGER CB NO CASCADE BEFORE
INSERT ON BONUSES
REFERENCING NEW AS n
FOR EACH ROW MODE DB2SQL
SET BONUS =
WHEN (n.BONUS = 0) THEN 100
ERROR 42Z9D: 'UPDATE' statements are not allowed in 'BEFORE' triggers.
|Field||Original Value||New Value|
|Summary||Trigger activation||Improve documentation for BEFORE triggers|
|Urgency||Low [ 10053 ]|
|Workflow||jira [ 40784 ]||Default workflow, editable Closed status [ 12801727 ]|