Subject | Trigger not firing when supposed too |
---|---|
Author | Uwe Oeder |
Post date | 2003-11-11T12:17:08Z |
I have a problem when inserting records as my trigger that is supposed to
insert a value for the primary from a generator. The Trigger looks as
follows. :
CREATE GENERATOR GenDescription ;
SET GENERATOR GenDescription TO 1 ;
SET TERM !! ;
CREATE TRIGGER TrigGenDescription FOR Description
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.DescrIDSQ IS NULL) THEN
NEW.DescrIDSQ = GEN_ID(GenDescription,1) ;
END !!
The trigger shows when I type : "show triggers;"
However as soon as I try to insert the second record it throws me the
following error :
"
SQL Error: violation of PRIMARY .....
Error Code : -803. Invalid insert or update value(s): object columns are
constrained - no 2 table rows can have duplicate column values'.
"
When I do a SELECt on the Table ony one entry has been added with a primary
key of 13596856. How do I make my trigger fire.
insert a value for the primary from a generator. The Trigger looks as
follows. :
CREATE GENERATOR GenDescription ;
SET GENERATOR GenDescription TO 1 ;
SET TERM !! ;
CREATE TRIGGER TrigGenDescription FOR Description
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.DescrIDSQ IS NULL) THEN
NEW.DescrIDSQ = GEN_ID(GenDescription,1) ;
END !!
The trigger shows when I type : "show triggers;"
However as soon as I try to insert the second record it throws me the
following error :
"
SQL Error: violation of PRIMARY .....
Error Code : -803. Invalid insert or update value(s): object columns are
constrained - no 2 table rows can have duplicate column values'.
"
When I do a SELECt on the Table ony one entry has been added with a primary
key of 13596856. How do I make my trigger fire.