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: Create view with Order By

Re: Create view with Order By

From: Connor McDonald <mcdonald.connor.cs_at_bhp.com.au>
Date: Wed, 14 Apr 1999 13:52:27 +0900
Message-ID: <37142D1B.3257@bhp.com.au>


Neil Moseley wrote:
>
> Thanks for the response Chris, unfortunately, my particular client
> software does not permit access to the SQL, and simply returns all records
> in the view/table. I should have mentioned this in my original post.
>
> Chris Hamilton wrote:
>
> > On Tue, 13 Apr 1999 22:59:39 +0800, Neil Moseley <mose_at_iinet.net.au>
> > wrote:
> >
> > >G'day all,
> > >
> > >This statement works fine:
> > >SELECT * FROM MYTABLE ORDER BY MYCOLUMN;
> > >But this does not:
> > >CREATE VIEW TEMP AS SELECT * FROM MYTABLE ORDER BY MYCOLUMN;
> > >
> > >If ORDER BY cannot be used when creating a view, is there a solution.
> >
> > You have to order-by dynamically at run time.
> >
> > create view temp as select * from mytable;
> >
> > select * from temp order by mycolumn;
> >
> > Views do not store the data, nor the sort order - just the query.
> >
> > Chris
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Christopher Hamilton
> > Oracle DBA -- Wall Street Sports
> > chris_at_wallstreetsports.com
> > http://www.wallstreetsports.com/

You can use a "group by" in a view - but note that this is an approximation only - it it may be sorted, it may not be...

In 8i, you will be able to have order-by inline --



Connor McDonald
BHP Information Technology
Perth, Western Australia
"Never wrestle a pig - you both get dirty and the pig likes it..." Received on Tue Apr 13 1999 - 23:52:27 CDT

Original text of this message

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