Aneez Backer wrote:
Hi Bernt

This is regarding the Derby equivalent of MySQL Trigger statements

The statements you sent worked all right with Derby 10.3.1.4
But, When I try to run them on Derby 10.2.1.6, it gives the following error

ERROR 42X01: Syntax error: Encountered "UPDATE" at line 5, column 1.

Isn't update a part of the 10.2.1.6 SQL syntax ??

In 10.2, it was required to include "MODE DB2SQL" in "FOR EACH" clauses. This requirement was removed for 10.3. (Ref. http://issues.apache.org/jira/browse/DERBY-1953.) Hence, for 10.2 your first statement need to look as follows:

CREATE TRIGGER TrignameA
AFTER DELETE ON TABLEA
REFERENCING OLD AS O
FOR EACH ROW MODE DB2SQL
UPDATE TABLEB SET TAGCOUNT=(TAGCOUNT-1) WHERE ID=O.TAG_ID;

--
Øystein

Reply via email to