Subject Re: [firebird-support] Exception handling in loop
Author Thomas Steinmaurer
> I want to select a bunch of items and insert them somewhere else. If
> the insert fails because of a duplicate primary key or unique
> constraint, I want to abandon that particular item and continue with the
> rest.
> This code outlines my logic. Is this correct for what I'm trying to
> accomplish?
>
> BEGIN
>
> FOR SELECT DO BEGIN
>
> BEGIN
>
> INSERT
>
> END /* INSERT */
>
> WHEN GDSCODE unique_key_violation DO
> BEGIN
> /* NOP */
> END
>
> END /* SELECT */
>
> END /* PROCEDURE */

I guess this should be:

BEGIN
FOR SELECT DO
BEGIN
INSERT
WHEN GDSCODE unique_key_violation DO
BEGIN
/* NOP */
END
END /* SELECT */
END /* PROCEDURE */



Regards,
Thomas