| Author | 
		  Message
		 | 
		
		  | Segs | 
		  
		    
			  
				 Posted: Fri Jun 28, 2002 5:57 am    Post subject: INSERT using EVAL | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 04 Oct 2001 Posts: 78 Location: Zurich Financial Services 
  | 
		  
		    
			  
				I reading xml to create two string variables, one contains the list of columns I want to insert, the other the values:
 
 
ColumnString = '(CharCol1, CharCol2, IntCol1, CharCol3)'
 
ValueString = '('ABC', 'DEF', 14, 'GHI')
 
 
Then using the eval function I'm trying to do the insert
 
 
EVAL('INSERT INTO Database.Table1 || ' ' || ColumnString || ' VALUES ' || ValueString)
 
 
This gives me 
 
 
BIP2402E: (1, 1) : Syntax error : 'integer INSERT'. 
 
                                       The token caused a syntax error. 
 
 
I've used the evaluated statement generated in a trace as a straight forward insert and this worked ok.
 
 
Does anyone have any ideas on this?
 
 
Seg... | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CodeCraft | 
		  
		    
			  
				 Posted: Fri Jun 28, 2002 6:02 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Disciple
 
 Joined: 05 Sep 2001 Posts: 195
  
  | 
		  
		    
			  
				| What sort of a node are you using - do you need to be passing the INSERT to the database with a PASSTHRU statement? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Segs | 
		  
		    
			  
				 Posted: Fri Jun 28, 2002 6:25 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 04 Oct 2001 Posts: 78 Location: Zurich Financial Services 
  | 
		  
		    
			  
				| I'm using a database node, I don't really want to use passthru as I believe with this I wont be able to tell if it has worked or not, is this true? I need to know the result of the insert to send back to a housekeeping queue. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CodeCraft | 
		  
		    
			  
				 Posted: Fri Jun 28, 2002 6:33 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Disciple
 
 Joined: 05 Sep 2001 Posts: 195
  
  | 
		  
		    
			  
				| Send the complete ESQL for the node. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Segs | 
		  
		    
			  
				 Posted: Fri Jun 28, 2002 9:13 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 04 Oct 2001 Posts: 78 Location: Zurich Financial Services 
  | 
		  
		    
			  
				I won't be able to get the code until Monday I'll send it in first thing.
 
 
Thanks | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Segs | 
		  
		    
			  
				 Posted: Mon Jul 01, 2002 6:39 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 04 Oct 2001 Posts: 78 Location: Zurich Financial Services 
  | 
		  
		    
			  
				| This is a known bug apar IC32530 has been created. The problem is because the EVAL syntax check does not work for this. Managed to work around the problem. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | lillo | 
		  
		    
			  
				 Posted: Mon Jul 01, 2002 12:03 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Master
 
 Joined: 11 Sep 2001 Posts: 224
  
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	
 
Then using the eval function I'm trying to do the insert 
 
 
EVAL('INSERT INTO Database.Table1 || ' ' || ColumnString || ' VALUES ' || ValueString) 
 
 
 | 
   
 
 
 
I saw in your ESQL code a error. The code should be as:
 
EVAL('INSERT INTO Database.Table1' || ColumnString || ' VALUES ' || ValueString) 
 
 
Was this a mistype error? _________________ Lillo
 
IBM Certified Specialist - WebSphere MQ | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |