Subject | Re: [firebird-support] Exception handling in loop |
---|---|
Author | Thomas Steinmaurer |
Post date | 2013-01-10T18:51:26Z |
> I want to select a bunch of items and insert them somewhere else. IfI guess this should be:
> 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 */
BEGIN
FOR SELECT DO
BEGIN
INSERT
WHEN GDSCODE unique_key_violation DO
BEGIN
/* NOP */
END
END /* SELECT */
END /* PROCEDURE */
Regards,
Thomas