|
Bill Howie on 09/02/2014 07:23 AM wrote:
Not sure if this really falls in the RPG group or not, but sinceDefinitely an RPG question. Without a doubt.
there isn't an SQL group I will put it here. I have a program whose
concept is to take 3 incoming parameters (file name, field name,
and company number) and load them into an embedded SQL statement
and execute that statement.
Here is my code:
D File_Name S 10A
D Field_Name S 10A
D Company_Name S 2A
D Bogus_Field S 2A
D MySQLText S 300A varying
D Result S 100A varying
* Parameters:
* ~~~~~~~~~~~
*
C *Entry Plist
C Parm File_Name
C Parm Field_Name
C Parm Company_Name
/free
MySQLText = 'Update ' + %Trim(File_Name) +
' Set ' + %Trim(Field_Name) +
' = ' + %Trim(Company_Name);
exec sql
SET OPTION
commit=*none,
datfmt=*iso;
exec sql prepare SQL_Stmt from MySQLText;
exec sql execute SQL_Stmt;
*inlr = *on;
/end-free
Pretty basic. When it executes I get the following error:
Column or global variable MYSQLTEXT not found.
Prepared statement SQL_STMT not found.
But, the answer is change
exec sql prepare SQL_Stmt from MySQLText;
to
exec sql prepare SQL_Stmt from :MySQLText;
The former is looking for a variable outside of your RPG program.
The latter is looking for one of your RPG variables.
This mailing list archive is Copyright 1997-2026 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.