Re: INSERT cursors
Posted in 1998
Carlson@WHSmith wrote: > > Art S. Kagel wrote: > . . . snip . . . > [SNIP] > > But within a transaction . . . shouldn't the whole transaction roll > back? That kind of depends on what a logical transaction is compared to a physical transaction. In your code a rollback would only unwind to the last commit and would include the rows properly inserted prior the the row in error. In a load program sometimes it is important to just get all the rows one can into the table and be able to correct and redo the ones that fail. So if you save the rows between FLUSHes into an array when an error occurs you can dump the offending row (data_array[sqlca.sqlerrd[2]]) to a log file somewhere, then re-PUT the rows inserted after the offending row and FLUSH them, verifying that they all succeeded and commit that before continuing with more new records. Art S. Kagel