troubleshooting Question

IB/FB generators and how do they work ??

Avatar of cosmowen
cosmowen asked on
Databases
8 Comments2 Solutions893 ViewsLast Modified:
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:
 AS
  BEGIN
     NEW.PK_INDEX = GEN_ID(POSTRANS_GEN,1)
END

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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros