Re: Exception Handling in Stored Proc's
Posted in 1998
Shew Leong wrote:
>
> Hi Octav,
>
> I tried what you suggested and it worked the 1st time but on the 2nd try.
> Informix errored out with table is not in the database. I guess what it did
> was try to drop the table even it was error -310.
>
> I went through the manual again and tried:
>
> BEGIN
> ON EXCEPTION IN (-310) SET err_num
> IF err_num = -310 THEN
> DROP TABLE dah;> END IF
>
> SELECT ....>
> END
I ran into this one last year and reported it as a bug. I do not
remember the bug number. The workaround, as Thomas suggested, is to
reverse the logic. Drop the temp table at the top of the procedure
and trap and ignore the "table not found" error rather than trying to
recover from the "table already exists" error.
Art S. Kagel