Re: default select order

From: gazzag <gareth_at_jamms.org>
Date: Thu, 8 Jan 2009 05:02:53 -0800 (PST)
Message-ID: <8731395a-e7ad-4a68-a3a8-64ec7bede882_at_d42g2000prb.googlegroups.com>



On 7 Jan, 13:14, "Maija-Leena" <kangasm..._at_netti.fi> wrote:
> Hi,
> we have changed from Oracle 7 to Oracle10g2 and found a mistake from our
> program that didn't appear in the old environment.
>
> That is, we have two select-statements that should return rows in the same
> order but there is no order by -clause.
> Now I'm wondering why 10g2 works like this (every time I query)? What
> determines the order of the returned rows?
> SELECT X FROM TABLE_Z WHERE SOMETHING ='SOMETHING' ;
>
> A
>
> V
>
> E
>
> SELECT Y FROM TABLE_Z WHERE SOMETHING='SOMETHING' ;
>
> Avoin (refers to A)
>
> Ei kaytossa  (refers to E)
>
> Valmis (refers to V)
>
> If I change the first query to SELECT X,Y, then I get the same order than
> the last query. Column Y is not in primary key or any index. Is there a way
> to fix this  in the database ?
>
> Regards,
>
> Maija-Leena

If you don't specify an "ORDER BY" clause, the order that your result set is returned is not guaranteed. It's that simple.

HTH -g Received on Thu Jan 08 2009 - 07:02:53 CST

Original text of this message