It sounds like you need to add some nested compound statements. Handlers
are scoped to the BEGIN/END compound statement where they are defined. You
can have handlers for the same condition in multiple compound statements,
including the outermost level.

Sue Romano
Db2 for IBM i Development


When you have declared an SQL Exception handler, how do you make
an exception for a particular exception? For example...

I have a script that creates an alias in QTEMP during execution.
But, if any other exception occurs, the alias is left in QTEMP. So, I
want to clean up this possibility when the script first starts. This
works if the alias is there. But, if it is not there an exception
occurs.
I want to detect this situation and ignore the exception.

I even tried doing the DROP within the exception handler itself so

that the alias wouldn't be left in QTEMP at all. However, if an
exception
occurs before the alias first gets created, then the exception handler
throws an error during the DROP and the original exception never gets
displayed.

I also thought of creating an SQL Continue handler for the
specific SQL State, but I don't want this SQL State to always continue.

The potential exists for the same SQL State to occur in other places in

the script and I don't want those situations handled the same.

Is there a way to to be even more selective with handlers --
without having to go to the extreme of doing completely away with all
handlers and then having to do error checking on a
statement-by-statement
basis?

How do I handle all this? Thanks.


No responses on this?


Sincerely,

Dave Clark






As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.