Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Make ORDER BY in a view?
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