RE: Sorting in a query

  • From: "Gaston, William" <wgaston@xxxxxxx>
  • To: <Maertensj@xxxxxxxxxxxxx>
  • Date: Fri, 10 Dec 2004 10:26:49 -0700

I tried the decode and it works perfectly.
Thanks for the help.

Bill

William Gaston
Systems Designer / Information Technology
USG Corporation
Chicago, Il 60606
(312) 606-3851
wgaston@xxxxxxx


-----Original Message-----
From: Maertensj@xxxxxxxxxxxxx [mailto:Maertensj@xxxxxxxxxxxxx]=20
Sent: Friday, December 10, 2004 11:20 AM
To: Gaston, William
Subject: RE: Sorting in a query


You might try a decode in your where clause. I'm not sure this will
help, but it might be possible to do something like=20

select ...
where x in (:n1, :n2...)
order by decode(x, :n1, 1, :n2, 2...)

Anyway, just a thought.

-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx]
On Behalf Of Gaston, William
Sent: Friday, December 10, 2004 11:02 AM
To: Oracle-L@xxxxxxxxxxxxx
Subject: Sorting in a query

I have an odd problem.  I have a list of numbers that serve as=20
extract parameters in a query select ...where x in number list). =20
The numbers are in a specific sequence which does not match=20
the sequence of the extracted data.  The user wants the data in=20
the same order as the list of numbers supplied.  Is there any easy=20
way to do this within the query?
=20
Thanks for any help.
=20
Bill
=20
William Gaston
Systems Designer / Information Technology
USG Corporation
Chicago, Il 60606
(312) 606-3851
wgaston@xxxxxxx
=20
--
//www.freelists.org/webpage/oracle-l
--
//www.freelists.org/webpage/oracle-l

Other related posts: