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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Query sorting without Order by

Re: Query sorting without Order by

From: <jdorlon_at_my-deja.com>
Date: Mon, 05 Feb 2001 18:53:21 GMT
Message-ID: <95msqt$9ja$1@nnrp1.deja.com>

It *IS* possible to get rows back in order without a sort, assuming you have an index on what you want to sort by!

Let's say you have a table called MY_TABLE, and it has an index called MY_TABLE_X. You can get the rows back in the order of the index like this :

select /*+ INDEX (MY_TABLE_X, MY_TABLE) */ * from MY_TABLE

if you want the rows in decending order, do this

select /*+ INDEX_DESC (MY_TABLE_X, MY_TABLE) */ * from MY_TABLE

--John

Sent via Deja.com
http://www.deja.com/ Received on Mon Feb 05 2001 - 12:53:21 CST

Original text of this message

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