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

Home -> Community -> Usenet -> c.d.o.server -> Re: general question

Re: general question

From: sk <someone_at_somewhere.org>
Date: Sat, 28 Dec 2002 03:32:28 GMT
Message-ID: <3E0D1AFF.DCA7F2F@somewhere.org>


Right on the money. Was going to say I do not know what I was thinking.... but then all the wise guys would be able to chime in.

Ok, I will say it for everyone. It is probably time for me to go to the 'home'. Thank you to everyone who tried to help this feeble minded person.

Wanderley M Ceschim wrote:

> sk wrote:
> > I know it is not the way the data is actually stored. If I do a "select
> > *", I believe I get the correct order. I am trying to understand
> > why/how the system provides the result seemingly sorted as stated below.
> >
> >
> >
> > Jim Kennedy wrote:
> >
> >
> >>Pure chance. Don't rely on it.
> >>Jim
> >>"sfk" <stefano1_at_att.net> wrote in message
> >>news:3Q6P9.81319$hK4.6680146_at_bgtnsc05-news.ops.worldnet.att.net...
> >>
> >>>Using 9i SQL on HR employees table, perform
> >>>
> >>>SELECT LAST_NAME FROM EMPLOYEES
> >>>
> >>>why do the names sort out alphabetically asc? Is there a default
> >>>working?
> >>>
> >>>
> >>>
> >
> >

>

> Most likely you have an index on the LAST_NAME column, in which case
> Oracle will get the LAST_NAME values directly from the index (and
> therefore will show the results in order) using a fast full index scan
> and will never even touch the table. You'll see that if you run the
> query in sqlplus with "SET AUTOTRACE ON".
>

> This would account for the difference if you "SELECT *", because in this
> case Oracle would have to access the table directly and will show you
> the data in the order it is layed out in the data blocks.
>
> The only way to guarantee a specific order is to use ORDER BY.
Received on Fri Dec 27 2002 - 21:32:28 CST

Original text of this message

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