How to use IN statement with ORDER BY asc/desc in ORACLE queries?
Following queries worked properly, which are without IN statement:
1-SELECT ROLE,NAME,INSTITUTION
FROM ROLE
ORDER BY INSTITUTION ASC
2-Select Error, NAME,DESCRIPTION,FILE,CATEGORY
from errorcodes ORDER BY CODE ASC;
but when I use ORACLE query with IN it gives error, the query is:
3-SELECT *
FROM CUST
WHERE ORDER BY Channel IN ('0007', '9999','0001') ASC;
How can I write the above query properly?
Thanks in advance.

Manikavelu VelayuthamRank #413 · 6K reputationPosted Sep 19, 2010, 11:37 PM EDT
SELECT *
FROM CUST
WHERE Channel IN ('0007', '9999','0001') ORDER BY Channel ASC;
Noushad Moh5 reputationPosted Sep 19, 2010, 11:57 PM EDT
Suthish NairRank #92 · 22.8K reputationPosted Sep 20, 2010, 12:02 AM EDT
try this..
select * from
(
select rownum, a.* from cust a where channel in ('0007', '9999','0001')
)
order by rownum desc;