Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> "order by" with "where value in" clause problem
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