Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Do I need "ORDER BY"
You can't count on a query without an ORDER BY to always
return rows in any particular order. It might work most of
the time, but I garuntee you it will fail some of the time.
Someone please correct me if I'm wrong on this, but if the
sort key matches the index key, I think Oracle is smart
enough to know that it can skip the sort.
Jonathan
On Fri, 10 Sep 1999 11:32:05 -0400, Mark Schenkel <markschenkel_at_alpinesoftware.com> wrote:
>Will the following two SQL Statements retrieve the same result sets if
>there is a index on MKEY?:
>
>SELECT * FROM MYTABLE WHERE MKEY >= ' '
>
>SELECT * FROM MYTABLE WHERE MKEY >= ' ' ORDER BY MKEY
>
>My thinking is that for the first statement the server will use the
>index because of the "WHERE" clause. It will then continue to use this
>index when it returns the records from the server.
>
>Thanks, Mark.
Received on Fri Sep 10 1999 - 22:28:21 CDT
![]() |
![]() |