Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Peter Schubert — — source: Informix-list mailing list archive (1991-1998)
> How would I povide a fake rowid column eg called recordnum.
> I want each row to have a unique id (eg an int) so that I can
> use it in select statements.
Every INFORMIX Table has a "field" named rowid you can use it in different
ways:
e.g:
DEFINE xcust RECORD LIKE cust.*
DEFINE xrowid LIKE cust.rowid
SELECT rowid,cust.* INTO xrowid,xcust.* FROM cust
WHERE cust.cust_num = xcust_num.
. .
UPDATE cust SET cust.cust_name=xcust.cust_name
WHERE rowid = xrowid>
> I obviously specify UNIQUE? but how do I automatically
> create new recordnums. Do I declare that column as SERIAL as well?
SERIAL fields are allways UNIQUE. If you want to create a new SERIAL no.
just use a variable with the value 0. After the INSERT of the row you can
find out the new number with:
DEFINE new_serial integer
LET new_serial = SQLCA.SQLERRD[2]
cu Peter
--------------------------------------------------------------------------
SACO Software and Consulting GmbH E-Mail: psc@saco.ufra.net
Peter Schubert FAX: ++49 6021 498747
Auhofstr. 9
D-63741 Aschaffenburg
GERMANY
--------------------------------------------------------------------------
CASE * CAST * Softwaredevelopment * Consulting * HARDWARE * USV
--------------------------------------------------------------------------
## CrossPoint v3.02 ##
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.