I'm trying to see if I can update a column with a sequences NEXTVAL with a trigger set to be
called prior to an insert call.
I have not had much luck. I can't seem to reference the sequence name in the trigger, even
taking a stab at using a referencing clause for it. I even tried to create a sequence within
Looking at the syntax diagram in the InfoCenter, I think I'm coming to the conclusion that
I can only assign literal values to a column.
Is this correct, or can someone provide an example of referencing a sequence within a trigger
to update a column?
thanks for any help,
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
1 reply Latest Post - 2009-07-21T13:42:26Z by SystemAdmin
Pinned topic Use of sequences withing triggers in solidDB?
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2009-07-21T13:42:26Z at 2009-07-21T13:42:26Z by SystemAdmin
SystemAdmin 110000D4XK115 PostsACCEPTED ANSWER
Re: Use of sequences withing triggers in solidDB?2009-07-21T13:42:26Z in response to gmonteroTry the following example:
DROP TABLE PEOPLE;
CREATE TABLE PEOPLE (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR);
DROP SEQUENCE SEQ1;
CREATE SEQUENCE SEQ1;
DROP TRIGGER TRIG1;
"CREATE TRIGGER TRIG1
REFERENCING NEW id as new_id
EXEC SQL WHENEVER SQLERROR ABORT;
EXEC SEQUENCE SEQ1.NEXT INTO NEW_ID;
insert into people (name) values ('Fred');