ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » DECLARE HANDLER

Post new topic  Reply to topic
 DECLARE HANDLER « View previous topic :: View next topic » 
Author Message
madi
PostPosted: Mon Oct 23, 2006 7:48 am    Post subject: DECLARE HANDLER Reply with quote

Chevalier

Joined: 17 Jan 2006
Posts: 475

Hi All

I tried to find some sample code for using the handlers in eSQL

I need to call a stored procedure from an external database and if it throws an exception i need to execute a set of statements

The actual code is

CallStoredProc(variable);

CASE variable
WHEN ''
---
---
END CASE;

Now I want to put a handler to take care of any exceptions related to the database or storedproc

If i get an exception in the CallStoredProc(variable); i want to set the return code my self and then execute the CASE statement

Now for that

DECLARE EXIT/CONTINUE?? HANDLER FOR SQLSTATE LIKE'%'
BEGIN
Call StoredProc(variables);
SET v_returnCode = 16;
END;

or

DECLARE CONTINURE HANDLER FOR SQLSTATE LIKE '%'
BEGIN
SET v_returnCode = 16;
END;

and then all the actual code

i think it is the second piece of code

plz advise

--madi
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Oct 23, 2006 8:08 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The syntax is definitely either "DECLARE CONTINUE HANDLER" or "DECLARE EXIT HANDLER", and not "DECLARE CONTINUE/EXIT HANDLER".

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ak20700_.htm

The difference between EXIT and CONTINUE is where the handler returns to. In an EXIT handler, it returns to the next statement outside the handler scope and in a CONTINUE handler it returns to the next statement after the one that failed. So it either exits the failing code or continues after the error.

In your case, an EXIT handler declared in your procedure would return AFTER the procedure call. But it wouldn't necessarily RETURN the right value.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » DECLARE HANDLER
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.