|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	     | 
	 | 
   
 
  
	|  ESQL handling of empty strings | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | nize | 
		  
		    
			  
				 Posted: Thu Oct 07, 2010 4:52 am    Post subject: ESQL handling of empty strings | 
				     | 
			   
			 
		   | 
		 
		
		   Voyager
 
 Joined: 02 Sep 2009 Posts: 90
  
  | 
		  
		    
			  
				I have the ESQL line
 
 
   
	| Code: | 
   
  
	
 
SET outputPointer.ns9:SubstitutionInformation.ns9:SubstitutedBySample.ns9:PartId = inputPointer.SUBSTITUTEDBY;
 
 | 
   
 
 
 
Sometimes the value of the field inputPointer.SUBSTITUTEDBY is empty. For these cases I would like that the field outputPointer.ns9:SubstitutionInformation.ns9:SubstitutedBySample.ns9:PartId is not even created. I achieve this by modifying the line as below:
 
 
   
	| Code: | 
   
  
	
 
         IF inputPointer.SUBSTITUTEDBY <> '' THEN
 
            SET outputPointer.ns9:SubstitutionInformation.ns9:SubstitutedBySample.ns9:PartId = inputPointer.SUBSTITUTEDBY;
 
         END IF;
 
 | 
   
 
 
 
Is there no prettier way of doing this? | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | crossland | 
		  
		    
			  
				 Posted: Fri Oct 08, 2010 1:31 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Master
 
 Joined: 26 Jun 2001 Posts: 248
  
  | 
		  
		    
			  
				| Have a look at the COALESCE function. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | nize | 
		  
		    
			  
				 Posted: Fri Oct 08, 2010 1:38 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Voyager
 
 Joined: 02 Sep 2009 Posts: 90
  
  | 
		  
		    
			  
				Yes, I considered that one, but
 
   
	| Code: | 
   
  
	
 
COALESCE(inputPointer.SUBSTITUTEDBY)
 
 | 
   
 
 
wouldn't return NULL when inputPointer.SUBSTITUTEDBY is equal to ''. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | Luke | 
		  
		    
			  
				 Posted: Fri Oct 08, 2010 3:21 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Centurion
 
 Joined: 10 Nov 2008 Posts: 128 Location: UK 
  | 
		  
		    
			  
				
   
	| nize wrote: | 
   
  
	Yes, I considered that one, but
 
   
	| Code: | 
   
  
	
 
COALESCE(inputPointer.SUBSTITUTEDBY)
 
 | 
   
 
 
wouldn't return NULL when inputPointer.SUBSTITUTEDBY is equal to ''. | 
   
 
 
 
NULLIF(inputPointer.SUBSTITUTEDBY, '') | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | nize | 
		  
		    
			  
				 Posted: Fri Oct 08, 2010 5:35 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Voyager
 
 Joined: 02 Sep 2009 Posts: 90
  
  | 
		  
		    
			  
				| Thanks Luke! I will try that one. I guess this is implicitly used in the mapping node. | 
			   
			 
		   | 
		 
		
		  | 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
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |