Subject | Arg.. Autonum generator newbie question... |
---|---|
Author | cowmix3 |
Post date | 2005-03-04T10:51:17Z |
I have looked at every example and I can't get things to work.. Here
is what I have for my example:
CREATE TABLE "ITEMS"
(
"ITEMNUM" INTEGER NOT NULL,
"CATEGORYNUM" INTEGER,
PRIMARY KEY ("ITEMNUM")
);
CREATE GENERATOR ITEMNUM_ID;
COMMIT;
SET TERM;
CREATE TRIGGER ITEM_ID_TRIG FOR ITEMS
BEFORE INSERT POSITION 0
AS BEGIN
ITEMS.ITEMNUM = GEN_ID(ITEMNUM_ID, 1);
END
SET TERM ;
And I get something like this:
ISC ERROR CODE:335544351
ISC ERROR MESSAGE:
unsuccessful metadata update
DEFINE GENERATOR failed
attempt to store duplicate value (visible to active transactions) in
unique index "RDB$INDEX_11"
Arg!
Help!
<march>
is what I have for my example:
CREATE TABLE "ITEMS"
(
"ITEMNUM" INTEGER NOT NULL,
"CATEGORYNUM" INTEGER,
PRIMARY KEY ("ITEMNUM")
);
CREATE GENERATOR ITEMNUM_ID;
COMMIT;
SET TERM;
CREATE TRIGGER ITEM_ID_TRIG FOR ITEMS
BEFORE INSERT POSITION 0
AS BEGIN
ITEMS.ITEMNUM = GEN_ID(ITEMNUM_ID, 1);
END
SET TERM ;
And I get something like this:
ISC ERROR CODE:335544351
ISC ERROR MESSAGE:
unsuccessful metadata update
DEFINE GENERATOR failed
attempt to store duplicate value (visible to active transactions) in
unique index "RDB$INDEX_11"
Arg!
Help!
<march>