×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
exec sql prepare stmSql from :wSql;
exec sql execute stmSql;
--
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Daniel Gross
Sent: Tuesday, January 23, 2024 12:17 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: How do I do a EXECUTE IMMEDIATE with a declare?
Hi Darryl, what you want is a cursor declaration for a dynamic statement? wSql = 'select ... from ...'; exec sql prepare stmSql from :wSql; exec sql declare csrSql cursor for stmSql; exec sql open csr
External (daniel@xxxxxxxx<mailto:daniel@xxxxxxxx>)
Report This Email<
https://protection.inkyphishfence.com/report?id=d2luY29mb29kcy9jaHJpcy5oaWViZXJ0QHdpbmNvZm9vZHMuY29tL2ZiMjk4YjljMTQzZWQyZmUyOTI4NTkyN2VjOTNkODYwLzE3MDYwMzc0NjAuNjI=#key=9dfb16c94248df0073aa30efa843753a>
Hi Darryl,
what you want is a cursor declaration for a dynamic statement?
wSql = 'select ... from ...';
exec sql prepare stmSql from :wSql;
exec sql declare csrSql cursor for stmSql;
exec sql open csrSql;
This should work.
AFAIK you cannot declare with execute immediate.
HTH
Daniel
Von meinem iPhone gesendet
Am 23.01.2024 um 20:10 schrieb dfreinkel@xxxxxxxxxxxxxxxxx<mailto:dfreinkel@xxxxxxxxxxxxxxxxx>:
I have not done this in ages and do not remember the details or have a
program as an example.
I need to use a combination of a SQL DECLARE with a EXECUTE IMMEDIATE.
My program will not compile.
Example:
wSql = 'DECLARE FILE scroll cursor for select';
exec sql execute immediate :wSql;
TIA,
Darryl Freinkel
A4G
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.