Re: Retreiving serialno thru sqlerrd when using cursor for insert.
Posted in 1994
>From: ravindra@nit.airtouch.com (Ravindra Sahasrabudhe) >Subject: Retreiving serialno thru sqlerrd when using cursor for insert. >Date: Wed, 14 Sep 1994 18:16:48 GMT >X-Informix-List-Id: <news.8741> >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? The whole point of PUT statements is to buffer up the INSERT operations so that they are done in small batches instead of one at a time. However, using an INSERT cursor (PUT statement) also means that you don't mind losing the row-by-row control over what happens to the inserted row. Clearly, in this case, you do mind what happens. That being so, you should replace the INSERT cursor for cur_table1 with (a prepared) INSERT statement instead. You might or might not want to replace the cursor for cur_table2. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>