Re: dbload rejects
Posted in 1998
Keith Ford wrote:
>
> Running Informix 4.10 on SCO.
>
> When dbload runs it allows me to specify how many rows to insert before
> doing a commit work. If any duplicate keyed records are inserted they are
> rejected and displayed. Now, when I try to do something similar with code
> using ESQL/C it doesn't work. The inserts do not fail. I only get an
> error when I perform the commit work. Does anyone know what my problem is?
Peter L's posting says it, also the INSERT CURSOR MUST be opened with
the WITH HOLD option so that the CURSOR survives the COMMIT WORK or
ROLLBACK WORK. Basically the sequence is:
DECLARE curs CURSOR ...
BEGIN WORK
OPEN curs
WHILE THERE IS DATA
PUT curs
INCREMENT count
WHEN count >= THRESHOLD THEN
FLUSH curs
COMMIT WORK
BEGIN WORK
ZERO count
END
END
IF count > 0 THEN
COMMIT WORK
ELSE
ROLLBACK WORK
END
CLOSE curs
For an example download my latest submission to the IIUG Software
Repository, utils2_ak, and look at the source for ul.ec.
Art S. Kagel