Sequences and Serials
Posted in 1999
Topics: Triggers, Constraints & Referential Integrity
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.
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.