I am trying to total a an amount on a number of records in a file within 
an RPG program using embedded SQL.
I am building up the SQL statement using:
C* Build the SQL Statement for the current line...                   
C                   Eval      wSql = 'select sum(' + %Trim(CAENVN) + 
C                               ') into ? from ' + %Trim(CAEMVN)     
                                                                    
C* If selection criteria was passed and it isn't *NONE then add it to
C* the SQL statement...                                              
C                   If        CAAGNC <> *Blanks and CAAGNC <> '*NONE'
C                   Eval      wSql = %Trim(wSql) + ' where ' + CAAGNC
C                   EndIf                                            
And then preparing and running it using:
C* Now execute the SQL statement...
C/Exec SQL                         
C+ Prepare prpSQL from :wSQL       
C/End-Exec                         
                                  
C/Exec SQL                         
C+ Execute prpSQL using :wTotal    
C/End-Exec                         
However, I am getting an error in the joblog that says:
Token ? was not valid. Valid tokens: : <IDENTIFIER>.
Can anybody tell me what I'm doing wrong?  I thought I had to use 
parameter markers for the variable name.
Thanks
Jonathan
As an Amazon Associate we earn from qualifying purchases.
	
 
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.