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



I have a rather large SQL statement and I'm wondering about host variables
in the ORDER BY clause because I'd rather not copy it a number of times to
just order it differently.  I can't find any IBM documentation describing
using host variables to specify an ORDER BY clause, but the Precompiler
seems to allow it, and the query optimizer said something about host
variables in the order by clause being a reason that an ODP might not be
re-used.  I figured from this that it was permissible.  It seems to just
whatever entry is in the host variable.

Anybody here had success or seen something about this?

Thanks in advance.

simplified example:
______________________________________
Eval  SORT1='FAC'

/EXEC SQL
SELECT PROD, CLASS, FAC
FROM IMAST
ORDER BY PROD, :SORT1
/END-EXEC
____________________________________
I've also tried:
Eval  SORT1=2

/EXEC SQL
SELECT PROD, CLASS, FAC
FROM IMAST
ORDER BY PROD, :SORT1
/END-EXEC
________________________________________




As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.