Re: Retreiving serialno thru sqlerrd when using cursor for insert.
Posted in 1994
->Subject: Retreiving serialno thru sqlerrd when using cursor for insert. ->Date: Wed, 14 Sep 1994 18:16:48 GMT ->Reply-To: ravindra@nit.airtouch.com (Ravindra Sahasrabudhe) ->Organization: AirTouch Communications -> ->I have two tables say table1, table2. ->The serialno of table1 is used as a key of table2. -> ->I am inserting rows in both the tables using cursors. -> ->The psuedo code looks something like below. -> ->put cur_table1 -> ->tab2.serial_no = sqlerrd[1] -> ->put cur_table2 -> ->The serial_no returned in tab2 is always 0. -> ->We are using ESQL/C. -> ->Is there any way to make this work? -> ->Thanks and regards -> ->-Ravi -> ravindra@nit.airtouch.com Ravi, tab2.serial_no should be an INTEGER, not a SERIAL, since you are not using it as a serial (primary key) but rather as a foreign key. However, assuming from what you have said that it *is* a serial, the return of 0 is correct. sqlerrd[1] only returns the value if you insert a 0 and have Informix assign the serial value. If you insert a NON-zero value, then Informix uses that value and returns 0 (C-ISAM error, indicating success) in sqlerrd[1]. I find it somewhat odd that Informix should use this field for two quite different types of return values. Regards, Alan ___________________________ ______________________| R. Alan Popiel |__________________________ \\ Internet: | Martin Marietta, SLS | / \\ alan@den.mmc.com | P.O. Box 179, M/S 3810 | Std disclaimers apply. / )Voice: | Denver, CO 80201-0179 USA | ( / 303-977-9998 |___________________________| (But you knew that!) \\ /________________________) (____________________________\\