Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Make ORDER BY in a view?

Re: Make ORDER BY in a view?

From: Andrew Forsyth <arf001DELETETHIS_at_yahoo.Kom>
Date: Fri, 11 Dec 1998 00:25:01 -0000
Message-ID: <Oi9RjzJJ#GA.413@nih2naaa.prod2.compuserve.com>

suisum_at_ecn.ab.ca wrote in message <366fc1e4.0_at_ecn.ab.ca>...
>Hi:
>
>I know that we can't use ORDER BY in a view. Is there any way to get
>around this?
>

Yeah, use ORDER BY when you select from it, like select * from Viewname order by Col;

But seriously, imagine if you *could* "order by" in view VA:

    CREATE VIEW VA AS SELECT X, Y FROM ... ORDER BY X; OK, now create another view

    CREATE VIEW VB AS SELECT X, Y FROM VA ORDER BY Y; and another view VC, ordered by X again, and so forth. This would be entirely logical, but would keep the sort algorithm merchants in business big time (first sort the result set of VA by X, then pass it to VB and sort it by Y, and then ...)

Really you only need to sort at the very last moment. So use a SELECT statement, not a VIEW.

I've wanted sorted views too from time to time but the implications are a bit difficult.

Hope this makes sense. Received on Thu Dec 10 1998 - 18:25:01 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US