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



On 22 Apr 2013 12:11, Dan Kimmel wrote:
I have not tried this, but apparently you can create a view with an
ordered subselect. Something like this is supposed to work:

CREATE VIEW ORDERED_CUSTOMER (ARBAL_CUST, ARBAL_BAL) AS
SELECT joined.ARBAL_CUST, joined.ARBAL_BAL
from
(SELECT ARBAL.CUST as ARBAL_CUST
, ARBAL.BAL as ARBAL_BAL
, (SELECT CUSNAME
from CUST
where ARBAL.CUST= CUST.CUST
) as CUSNAME
from ARBAL order by CUSNAME
) AS joined;


If that were able to effect proper ordering for the RPG OPEN, then so too would the following query utilizing the exact query offered by the OP, to give what could be a final resolution [if no keyed access path was necessary]:

create view ARBAL_ORDERED as
select
oj.?f1?, oj.?f2?, oj.?fn? /* explicitly name all of arbal.* */
from
( select arbal.*, tucust.tuname
from arbal
left outer join custmast
on abcustomer = tucust
order by tuname
) as oj /* Ordered_Join */


However, although a derived table expression can offer the capability to sort the intermediate results, the overall SELECT from the VIEW is still unordered, unless there is an ORDER BY. The outermost SELECT can not have an ORDER BY. AFaIK the OPEN of an SQL VIEW is implemented no different than an SQL OPEN for a SELECT on a VIEW; in either case, how the query engine implements its means to obtain the data is not influenced by the open being /native/ such that it would somehow honor the ORDER BY in the subselect as the effect of the overall /query/ SELECT which is the *unordered* result set for the OPEN.

Thus even if one were to experience many times in a row, an apparent effect matching the expectation of /ordered/ results, there is no assurance that the next request would effect that same order.

http://www.ibm.com/support/docview.wss?uid=nas18cbc115173a8dca286256c84006c6ead
"... When ordering of a cursor is not defined by an ORDER BY clause, the relative position of two rows is implementation-dependent..."

The native\RLA non-query open request has no means to request an ORDER BY. One would use OPNQRYF to effect that specification for use with RLA, or an ORDER BY specification on a SQL SELECT for use with SQL FETCH.


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.