db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From granbajo <CarlosMendo...@gmail.com>
Subject Problems porting trigger from DB2
Date Sun, 01 Jun 2008 11:42:26 GMT

Hello,

  I am porting an application from DB2 where I use some triggers to generate
unique ids (max previous id + 1).  I do not want to use an autoid column in
Derby because I already have some data that I need to migrate.

  This trigger works in DB2, up to version 8:

CREATE TRIGGER Tests.AutoCategoryID 
   NO CASCADE BEFORE INSERT ON Tests.Categories
   REFERENCING NEW AS n
   FOR EACH ROW MODE DB2SQL
   SET (n.categoryid) = (SELECT value(MAX(categoryid),0) + 1 FROM
Test.Categories);

  However, when I run it in Derby, I get the following error:

ERROR 42X01: Syntax error: Encountered "SET" at line 5, column 4.

  Any ideas?
-- 
View this message in context: http://www.nabble.com/Problems-porting-trigger-from-DB2-tp17584753p17584753.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Mime
View raw message