Home » SQL & PL/SQL » SQL & PL/SQL » Displaying records as it appears in the IN
Displaying records as it appears in the IN [message #313724] Mon, 14 April 2008 05:37 Go to next message
yoonus.it@gmail.com
Messages: 109
Registered: June 2007
Location: kuwait
Senior Member
Hi Experts,

I want to query a table with where cluase and im using IN.Is there a way to display fetched recrods as in the same way it appears in the IN clause.

Ex: select * from orders
where
order in ('658128','658177','658416','658129','658336','658338');

I want to display this records in the same way it appears in the IN cluase.

ie: first recrod displayed should be 658128 second 658177 and so on.

Looking forward to your replying
Re: Displaying records as it appears in the IN [message #313726 is a reply to message #313724] Mon, 14 April 2008 05:54 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
You can use the DECOCDE().

select * from emp
where empno in (7839,7934,7782)
order by decode(empno,7839,1,7934,2,7782,3).

regards,
Re: Displaying records as it appears in the IN [message #313747 is a reply to message #313726] Mon, 14 April 2008 07:23 Go to previous message
yoonus.it@gmail.com
Messages: 109
Registered: June 2007
Location: kuwait
Senior Member
Thanks alot Dhanjay Smile

It made my work much easier.
Previous Topic: UTL_FILE Directory
Next Topic: getting random results from a procedure
Goto Forum:
  


Current Time: Mon Dec 05 07:04:53 CST 2016

Total time taken to generate the page: 0.10049 seconds