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.
A newcomer to Informix asked how to get the SERIAL value of an inserted row for use as a foreign key, as Oracle sequences allow. Bernhard Gramberg said in 4GL it is in the SQL status record and ODBC handles serials poorly. Another poster said in ESQL/C it is in sqlca.sqlerrd[1] and knew no way in plain SQL. No complete answer.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
I am working with Informix for the first time. I understand the
basics of the Serial datatype. The problem that I am encountering is
that I need to get the value of the Serial field after the record has
been inserted, to use as a foreign key for records in other tables. I
have experience programming with Oracle and have used sequences in the
past which work very well for solving this problem. So my question is:
Is there a way to get the value of the key (Serial field) for the
record that was inserted?
Sent via Deja.com http://www.deja.com/
Before you buy.
↪ replying to troegers13@my-deja.com
Bernhard Gramberg — — source: Informix-list mailing list archive (1991-1998)
depends, what you work with.
In Informix 4GL, the created Number is in the SQL-Status Record
(I think it was sqlsca.warning[2] )
When using ODBC, I am not sure, because
ODBC is not good for serials.
troegers13@my-deja.com schrieb:
> I am working with Informix for the first time. I understand the
> basics of the Serial datatype. The problem that I am encountering is
> that I need to get the value of the Serial field after the record has
> been inserted, to use as a foreign key for records in other tables. I
> have experience programming with Oracle and have used sequences in the
> past which work very well for solving this problem. So my question is:
> Is there a way to get the value of the key (Serial field) for the
> record that was inserted?
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
In article <80s30t$7t6$1@nnrp1.deja.com>,
troegers13@my-deja.com wrote:
> I am working with Informix for the first time. I understand the
> basics of the Serial datatype. The problem that I am encountering is
> that I need to get the value of the Serial field after the record has
> been inserted, to use as a foreign key for records in other tables. I
> have experience programming with Oracle and have used sequences in the
> past which work very well for solving this problem. So my question
is:
> Is there a way to get the value of the key (Serial field) for the
> record that was inserted?
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
In ESQL/C, the value for the inserted serial value is stored in
sqlca.sqlerrd[1]. I'm sure there is something similar in 4gl and such,
but I don't use much else. I don't know of any way to get it in
straight SQL. Anyone else?
--
# unrm /
ksh: unrm: not found
# man cpio
Sent via Deja.com http://www.deja.com/
Before you buy.
Your privacy choices
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.