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