|
archives.I can't remember the exact syntax off hand but you will find it in the
One thing, Erick, those SQL statements don't need to be run Execute--
Immediate, you get better performance just running the statement itself:
exec sql DROP ALIAS QTEMP/AA;
exec sql CREATE ALIAS QTEMP/AA FOR QTEMP/DISP(DISP);
But using embedded SQL, you need to "Select/Into/" some host variable.
It has to return one row only, but your statement does that.
exec sql SELECT MAX( LENGTH( TRIM(DISP) ) ) INTO :MyVar FROM QTEMP/AA
Where after executed, MyVar should have the value of the length of the
longest line.
On 10/23/12 7:48 PM, Erick Garske wrote:
I have a SQLPRGLE program compiled to a target release of V5R4M0
that works correctly in V7R1M0, but throws a SQL exception when
processing the prepare statement. The purpose of the code is to
simply find the longest line in the file.
/ Eval cmdSQL = 'DROP ALIAS QTEMP/AA';
/ exec sql Execute Immediate :cmdSQL;
/
/ Eval cmdSQL = 'CREATE ALIAS QTEMP/AA FOR QTEMP/DISP(DISP)';
/ exec sql Execute Immediate :cmdSQL;
/
/ cmdSQL = 'SELECT MAX( LENGTH( TRIM(DISP) ) ) FROM QTEMP/AA';
/ exec sql prepare s1 from :cmdSQL;
SQL values after processing the prepare statement:
sqlcod = 204
sqlerm =
....5...10...15...20...25...30...35...40...45...50...55...60
' *ALL *N MEM '
' '
Does anyone know if there is an issue with the above code?
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
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.