Author |
Message
|
vijayakumar |
Posted: Thu Jan 27, 2011 10:33 pm Post subject: catch unclassified exceptions for database operations |
|
|
Centurion
Joined: 01 Aug 2010 Posts: 101
|
In the IBM infocenter help ,
gave the statement as
If you want to catch unclassified exceptions, use the "all" wildcard ("%") for the SQL state on the last handler of a scope. This wildcard will continue to catch the same set of exceptions if previously unclassified exceptions are given new unique SQL states.
how to use the wilcard for the sqlstate ? . can anyone help me with the example |
|
Back to top |
|
 |
saurabh867 |
Posted: Thu Jan 27, 2011 10:59 pm Post subject: |
|
|
Voyager
Joined: 13 Jun 2010 Posts: 78
|
Try to use like this :
DECLARE EXIT HANDLER FOR SQLSTATE LIKE '%' |
|
Back to top |
|
 |
vijayakumar |
Posted: Fri Jan 28, 2011 10:06 am Post subject: |
|
|
Centurion
Joined: 01 Aug 2010 Posts: 101
|
please suggest how to use this hander for DB related works. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jan 28, 2011 10:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So you asked how to specify that you wanted to catch all exceptions from a DB, regardless of what they were.
You were then told.
Now you want to know what to do with the exceptions?
Please try harder. |
|
Back to top |
|
 |
vijayakumar |
Posted: Fri Jan 28, 2011 11:27 am Post subject: |
|
|
Centurion
Joined: 01 Aug 2010 Posts: 101
|
wht will happen if there is no database exception happened in the exit handler ? |
|
Back to top |
|
 |
mgk |
Posted: Fri Jan 28, 2011 11:39 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
You can create a handler to catch all DB exception and only DB exceptions like this:
Code: |
DECLARE EXIT HANDLER FOR SQLSTATE LIKE 'D%' |
And if there is no exception your code in the handler will never be run...
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jan 28, 2011 11:41 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I do not have the honor to understand the question you have asked. |
|
Back to top |
|
 |
vijayakumar |
Posted: Fri Jan 28, 2011 11:52 am Post subject: |
|
|
Centurion
Joined: 01 Aug 2010 Posts: 101
|
If the database operation is happened successfully , the sqlstate will not return any value rite. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 28, 2011 11:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
vijayakumar wrote: |
If the database operation is happened successfully , the sqlstate will not return any value rite. |
a) this is a database question not a broker question
b) it will return a state indicating the successful completion of the database operation (depending on database platform to some extent) _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mgk |
Posted: Fri Jan 28, 2011 12:15 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
If the database operation is happened successfully , the sqlstate will not return any value right? |
Correct. _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|