Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: About ordering in SQL
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
![]() |
![]() |