× 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.



Hi,

SELECT ... INTO is not allowed with dynamic SQL, but VALUES INTO is!

MyStatement = 'Values(select date(JOTSTP), time(JOTSTP) +
From %TrimR(templib) + '/' + %TrimR(tempfile) +
ORDER BY JOTSTP desc +
fetch first 1 row only) into ?, ?';

Exec SQL Prepare DynSQL from :MyStatement;
Exec SQL Execute DynSQL Using :Date1, :Time1;



Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Dennis Lovelady
Gesendet: Thursday, 15. April 2010 23:59
An: 'Midrange Systems Technical Discussion'
Betreff: RE: dynamic sql query and variable substituion

Where i can pass templib and tempfile from other program, all the
tables
will have these 2 columns

dtemplib s 10a inz('QTEMP')
dtempfile s 10a inz('myfile')
d date1 s d
d time1 s t

MyStatement = 'select (date(JOTSTP)), (time(JOTSTP)) '
+ 'into :date1 , :time1 from '
+ %TrimR(templib) + '/' + %TrimR(tempfile)
+ ' ORDER BY JOTSTP desc fetch first 1 row only ';

Exec SQL
Execute Immediate :MyStatement;

This is not working for me at all

Define "is not working for me." I strongly suspect that you're getting an
error about returning too many rows, which would make perfect sense to me.

What are the values of SQLCOD and SQLSTATE when it "doesn't work for you?"

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"The income tax has made more liars out of American people than golf has."
-- Will Rogers




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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.