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 -> "order by" with "where value in" clause problem

"order by" with "where value in" clause problem

From: Sharkie <sharkdba_at_yahoo.com>
Date: 12 Jul 2005 15:08:00 -0700
Message-ID: <1121206080.555870.147650@g44g2000cwa.googlegroups.com>


Hello,

I'm using Oracle 8i on Solaris box. I have a list of values which will be passed to oracle "where in" clause.

for example, if id list = 1, 5, 80, 13, 4

This list will be passed to query where in clause:

select id, col1, col2, col3
from table1
where id in (1, 5, 80, 13, 4)

I need to make sure the select statement will return rows in the exact order
as the id list. Without an "order by" clause oracle returns them in whatever
order it likes, and I don't know what kind of order by clause would work here.

How can I assure the sort in this case? The id list is dynamically generated,
I will never know number of elements, and what order they will be. Received on Tue Jul 12 2005 - 17:08:00 CDT

Original text of this message

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