|  | 
 
  
    | RSS Feed - WebSphere MQ Support | RSS Feed - Message Broker Support |  
 
  
	|    |  |  
  
	| Checking for SELECT that returns no value | « View previous topic :: View next topic » |  
  	| 
		
		
		  | Author | Message |  
		  | AlexeiSkate | 
			  
				|  Posted: Thu Jun 13, 2002 9:23 am    Post subject: Checking for SELECT that returns no value |   |  |  
		  | Centurion
 
 
 Joined: 10 Apr 2002Posts: 123
 
 
 | 
			  
				| I have the folowing ESQL SELECT statements: 
 SET OutputRoot.XML."TEMP" = THE (SELECT X.UIDY, X.DTYP
 FROM Database.DB2USER.MF_CR AS X
 WHERE X.DOCUMENT_NUMBER = referencedDocumentNumber);
 
 I then have the following if statement ....
 
 if (OutputRoot.XML."TEMP"."UIDY") IS NULL
 THEN
 -- WRITE TO DATABASE OF SUSPENSE TABLE
 ELSE
 -- do something ...
 
 I know that the SELECT statement above did not find any record from the db, but the logic keeps on going to the ELSE part of the IF statement. When I look at UIDY in the trace file, the value is NULL. Is the condidition in my IF statement correct ? How can I check that a SELECT statement did not return anything ?
 Thanks,
 Alex
 |  |  
		  | Back to top |  |  
		  |  |  
		  | kirani | 
			  
				|  Posted: Thu Jun 13, 2002 11:45 am    Post subject: |   |  |  
		  | Jedi Knight
 
 
 Joined: 05 Sep 2001Posts: 3779
 Location: Torrance, CA, USA
 
 | 
			  
				| Alex, 
 Try changing your statement to
 if (OutputRoot.XML."TEMP"."UIDY".(XML.Content) = NULL )
 THEN
 ....
 
 You can make use of values set in SQLSTATE and SQLCODE variables to see what return values you are getting from database. For doing this, in your Compute Node's Advance tab you should uncheck "Throw Exception on Database Error".
 _________________
 Kiran
 
 
 IBM Cert. Solution Designer & System Administrator - WBIMB V5
 IBM Cert. Solutions Expert - WMQI
 IBM Cert. Specialist - WMQI, MQSeries
 IBM Cert. Developer - MQSeries
 
 
 |  |  
		  | 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
 
 |  |  |  |