|  | 
 
  
    | RSS Feed - WebSphere MQ Support | RSS Feed - Message Broker Support |  
 
  
	|    |  |  
  
	| [Solved] handler never entered | « View previous topic :: View next topic » |  
  	| 
		
		
		  | Author | Message |  
		  | Esa | 
			  
				|  Posted: Tue Jan 17, 2012 7:01 am    Post subject: [Solved] handler never entered |   |  |  
		  |  Grand Master
 
 
 Joined: 22 May 2008Posts: 1387
 Location: Finland
 
 | 
			  
				| I have written a little ESQL function: 
 
 
   
	| Code: |  
	| CREATE FUNCTION Traverse(IN inRef REFERENCE, IN outRef REFERENCE) RETURNS BOOLEAN
 BEGIN
 SET Environment.start='start';
 BEGIN
 DECLARE EXIT HANDLER FOR SQLSTATE LIKE '%'
 BEGIN
 DECLARE state CHARACTER SQLSTATE;
 SET Environment.handler = 'handler';
 -- do something
 WHILE some_condition DO
 IF Traverse(inRef, outRef) THEN
 -- do something
 ELSE
 RETURN FALSE;
 END IF;
 END WHILE;
 RETURN TRUE;
 END;
 END;
 SET Environment.end = 'end';
 RETURN FALSE;
 END;
 |  
 When I run/debug the flow, the handler code is never entered.
 
 Is it because the compiler has prevented using a handler recursively or have I done something wrong?
 
 Broker version 6.1.0.5, tested on AIX
 
 Last edited by Esa on Tue Jan 17, 2012 8:37 am; edited 1 time in total
 |  |  
		  | Back to top |  |  
		  |  |  
		  | mgk | 
			  
				|  Posted: Tue Jan 17, 2012 7:27 am    Post subject: |   |  |  
		  |  Padawan
 
 
 Joined: 31 Jul 2003Posts: 1647
 
 
 | 
			  
				| Well this code is the body of the HANDLER: 
 
 
   
	| Code: |  
	| DECLARE EXIT HANDLER FOR SQLSTATE LIKE '%' BEGIN
 DECLARE state CHARACTER SQLSTATE;
 SET Environment.handler = 'handler';
 -- do something
 WHILE some_condition DO
 IF Traverse(inRef, outRef) THEN
 -- do something
 ELSE
 RETURN FALSE;
 END IF;
 END WHILE;
 RETURN TRUE;
 END;
 |  
 And I see no code that could cause an exception that would cause the exception handler block to be entered.
 
 Kind 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 |  |  
		  |  |  
		  | Esa | 
			  
				|  Posted: Tue Jan 17, 2012 7:29 am    Post subject: |   |  |  
		  |  Grand Master
 
 
 Joined: 22 May 2008Posts: 1387
 Location: Finland
 
 | 
			  
				| Thanks, 
 Yes, I was putting the try code in the catch block.
 |  |  
		  | Back to top |  |  
		  |  |  
		  |  |  |  
  
	|    |  | Page 1 of 1 |  
 
 
  
  	| 
		
		  | 
 
 | 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
 
 |  |  |  |