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,
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 Posts
Re: Use of sequences withing triggers in solidDB?2009-07-21T13:42:26ZThis is the accepted answer. This is the accepted answer.Try 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');