|
I think this is correct:
- braces around the NO CASCADE BEFORE | AFTER - missing brace put back in after the UPDATE CREATE TRIGGER TriggerName { NO CASCADE BEFORE | AFTER } { INSERT | DELETE | UPDATE } [ OF column-Name [, column-Name]* ] ON table-Name [ ReferencingClause ] FOR EACH { ROW | STATEMENT } MODE DB2SQL Triggered-SQL-statement Attached patch fixes the syntax, adds NO CASCADE BEFORE, and mentions Before triggers in two additional places in the topic where it used to just mention After triggers. Please see attached output in html for review, and provide either feedback or a thumbs up so we can get the changes commited. Thanks!
The NO CASCADE BEFORE example in the patch won't work because BEFORE triggers don't allow INSERTs. A BEFORE trigger can execute a SQL function, so here's a suggestion:
CREATE TRIGGER t1 NO CASCADE BEFORE UPDATE ON x FOR EACH ROW MODE DB2SQL values app.notifyEmail('Jerry', 'Table x is about to be updated'); Attached patch uses Jean's example instead of the one previously there. Please review! Thanks!
In the Triggered-SQL-statement section, an additiona limitation is that before triggers can not have INSERT, UPDATE or DELETE statements as their action.
Attached patch adds the line Dan requested...please review!
Committed, revision 201702, Jeff Levitt's patch that documents BEFORE triggers. Changed files:
$ svn status M src/ref/rrefsqlj43125.dita |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
http://incubator.apache.org/derby/docs/ref/rrefsqlj43125.html
On that page, the syntax seems to be missing a closing curly brace "}" to the one that is opened after the "AFTER".
CREATE TRIGGER TriggerName
AFTER
{ INSERT | DELETE | UPDATE [ OF column-Name [, column-Name]* ]
ON table-Name
[ ReferencingClause ]
FOR EACH { ROW | STATEMENT } MODE DB2SQL
Triggered-SQL-statement
Where should the closing curly brace go?
Also, for NO CASCADE BEFORE, should I just modify this syntax to look like this?:
CREATE TRIGGER TriggerName
NO CASCADE BEFORE | AFTER
{ INSERT | DELETE | UPDATE [ OF column-Name [, column-Name]* ]
ON table-Name
[ ReferencingClause ]
FOR EACH { ROW | STATEMENT } MODE DB2SQL
Triggered-SQL-statement