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: About ordering in SQL

Re: About ordering in SQL

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 7 Sep 2000 08:44:09 +0200
Message-ID: <968346794.16691.0.pluto.d4ee154e@news.demon.nl>

According to relational database theory a set is by design unordered. You can't rely on Oracle to return the result in any fixed order (Your output is a typical result of using the rule-based optimizer, which parses from right to left; the cost-based optimizer parses from left to right).
Hence, the only method to guarantee a specific order is using order by. Indexing a column may help, but that is a *tric*.

Hth,

Sybrand Bakker, Oracle DBA

"Artti Jaakkola" <ext-artti.jaakkola_at_nokia.com> wrote in message news:PyGt5.10147$oL4.210919_at_news2.nokia.com...
> If I make following query:
>
> SELECT
> ID
> FROM
> SOMETABLE
> WHERE
> ID IN (1, 4, 6, 2)
>
> ID
> --
> 2
> 6
> 4
> 1
>
> Is the result always ordered like this or is there some better way to do
 it?
>
> --
> - Artti -
>
>
Received on Thu Sep 07 2000 - 01:44:09 CDT

Original text of this message

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