Re: Taking a serial number?
Posted in 2001
Once you insert into the INVOICE table (inserting zero for the serial column) you retrieve the assigned serial value from the engine, either by looking into the sqlca structure (see the ESQL manual) or by running the following DBINFO query: SELECT DBINFO( 'sqlca.sqlerrd1' ) INTO :lst_ser FROM systables where tabid = 1; Then you can use lst_ser as the related serial value for inserting into the INVOICE_ITEM table. Art S. Kagel Rafael Padilla wrote: > > Hi, > I'm developing a client aplication in DELPHI. > My Primary Keys are serial and I'm developing > an interface with two tables INVOICE and INVOICE_ITEMS. > I want to record all at the same time, but > I couldn't make this because I have not serial > to relate child records. > > So the INFORMIX question become:.... > > I like to know if is it possible increment > a serial value for a particular table in a > store procedure? > > This is to reserve a number that could be used or not. > For example: if table INVOICE has 100 like its last SERIAL > in ID Field, and I want to jump to 102 number to reserve 101 > for a later use, but all this I want to do it in one segment code, > because I want to return reserved number. > > I Think I can't use SQLCA parameter, because several people can > be update this table at same time, so I need some mechanism to > warrant this. > > I Accept other suggestions! > > Thanks for yor help! > > Sent via Deja.com > http://www.deja.com/