IB/FB generators and how do they work ??
Posted on 2004-03-31
Hey experts, I have a table and I need to generate a unique ID all the way throught the table ie( PK_INDEX, USER, TRANS ) lets say that those are my fields in my Table. Now in my program (C++) i need to create new users without every seeing the DB. I need a generator that will automatically create a new almost blank entry in my table, (by the almost blank, I mean I need a new unique index with no user or transaction so that when I:
insert into POSTRANS (PK_INDEX, USER, TRANS) values ( %d, %s, %d ), index, user_name, transaction_number;
what am I doing wrong in this call. I have my generator set up as:
NEW.PK_INDEX = GEN_ID(POSTRANS_GEN,1)
this is a type "BEFORE INSERT" . What am I doing wrong, is it the SQL statement in my C++ code or am I missing something in the vein of a stored procedure or what. This is beyond my understanding of DB's so PLease help..
Thanks in advance