1) the form is
wSqlStmt = '<something>' ;
exec sql prepare mystatement from :wSqlStmt
exec sql execute mystatement;

2) You can't use 'SELECT INTO' into a dynamic statement, use 'VALUES INTO'
instead

3) You don't need a dynamic statement here anyway
exec Sql
select AFIELD into :wField
from aMachine/aLibrary/aFile
where rrn(aFile) = :wSeed;

The only time you _need_ a dynamic statement is if the column names to
select or the table name is variable.
wSqlStmt = 'insert into ' + wTblName + ' values (1)';

Some choose to use a dynamic statement rather than a complex WHERE or ORDER
by clause.

HTH,
Charles




On Thu, Jan 24, 2019 at 4:09 PM Booth Martin <booth@xxxxxxxxxxxx> wrote:

exec sql prepare Stmt1 from
'select AFIELD from aMachine/aLibrary/aFile'
+ ' where rrn(aFile) = ?';
exec sql execute Stmt1 into :wField using :wSeed;

SQL0104 Token : was not valid. Valid tokens: SQL DESCRIPTOR

What is missing? I am finding nothing that I understand about DESCIPTORs

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].