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



This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Rob,
.
After many discussions with development, I think we have a solution to
the problem you were seeing.  According to development and what is
documented in the SQL Reference, the order by clause will accept a
a column name, an integer or a sort-key expression.  I've confirmed with
development that the integer must be in the form of a number and cannot
be a host variable.  When the term integer-expression is used,
then a number or a host variable or another numeric expression(X +Y)
can be used as a parameter.
The net is what you are seeing returned by your program is
working as designed.
.
There is another way to specify the SQL statement string so that
you can obtain the results that you are expecting.
If the Sqlstmt in your program is built dynamically using
Parm1, then prepared, you can still order the results by the
parameter passed in.
.
 Sqlstmt ='select ccust, cnme, cad1, cad2, cste, czip  ' +
         'From rcm '  +
     'where cmid=' + apos + 'CM' + apos + ' ' +
      'Order by ' +  %edict(Parm1:'Z')  + ' ' ;
.
The %edict function is used to convert the value in Parm1
to a character that is concatenated to the select
statement. Using this statement in your program gave me
the expected results.
.
Regards,
(name removed), Rochester Support Center, Database Team
------------------------------------------------------02/11/15-16:56--CC
Customer Rep: Rob
Action Taken: Notified customer of PMR update
Action Plan:  Email-fup

------------------------------------------------------02/11/19-13:54--AT
*** X1S2R3V4
*** Electronic update by customer
***
*** AS4SERV: AS/400 Monthly.
***
***
***
Additional Information:
So what you are saying is that
Order by :myvar
is not an error.  It will not create a invalid sql state SQLSTT, nor an
invalid SQL code SQLCOD.  However it is just ignored and any old sort
order is used?

How can this be 'working as designed'?  Who designed it so that an order
 by clause is ignored?

I consider the suggestion to use concantenation a work around until this
 is resolved.



Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin


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.