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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Record order in SELECT .. IN ( , , , ) queries

Re: Record order in SELECT .. IN ( , , , ) queries

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 26 Jan 2004 06:09:12 -0800
Message-ID: <2687bb95.0401260609.619f5a17@posting.google.com>


submit_at_galleus.com (Kurta) wrote in message news:<efcb1994.0401260151.7216f23c_at_posting.google.com>...
> When I start a SELECT IN query like this:
>
> SELECT USR_ID, USR_NAME FROM T_USR WHERE USR_ID IN (4, 2, 5, 1, 3);
>
> Is there a guaranteed result record order? I tried these queries and
> (using Oracle 9i) it always returned the results in reverse order (not
> the phisical order):
>
> USR_ID USR_NAME
> ----------------------------------------------
> 3 a
> 1 a
> 5 a
> 2 a
> 4 a
>
> Can I assume that this order is always the same? Is there a technical
> documentation about this?
>
> Thanks,
>
> Kurta

This may be a duplicate post as I received a server error screen on my first attempt to respond to this post.

The only way to guarentee the order of a result set is to use an order by clause such as order by usr_name, usr_id.

HTH -- Mark D Powell -- Received on Mon Jan 26 2004 - 08:09:12 CST

Original text of this message

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