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



"MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx> wrote on 07/28/2017
01:14:31 PM:
Yep, you can use a single-row fullselect to set variables using the SET
statement. So you could have this -

set (var1, var2) = (select var1val, var2val from sometable where
the-result-is-1-row, etc.)

Both VALUES INTO and SET have almost identical descriptions - the only
difference I can see that SET lets you use *DEFAULT as a value, if
listing the values.

Both produce a "result table" - so I don't see anything to say which to
use other than the above or just whichever syntax feels easier.

Thanks for that. Perhaps SET cannot be prepared for dynamic SQL
with placeholders in an RPG program?

sqlstmt = 'set (?, ?) = (select var1val, var2val from sometable where
the-result-is-1-row, etc.)';

I know that is why we use VALUES...INTO instead of SELECT...INTO.
The manual does seem to indicate that all values would have to be global
(SQL) variables in order to be used with PREPARE.

Sincerely,

Dave Clark

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.