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 -> Re: Multiple column sorting with a decode

Re: Multiple column sorting with a decode

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Thu, 24 Nov 2005 20:12:14 +0100
Message-ID: <4386108c$0$4347$626a54ce@news.free.fr>

<voidhack_at_gmail.com> a écrit dans le message de news: 1132858962.352135.52160_at_g49g2000cwa.googlegroups.com...
| Hello,
|
| I am trying to sort on multiple columns using a parameter that I
| specify as the sort order.
| For example,
| ...
| ORDER BY DECODE(:param,1, '1, 3', 2, '1,4')
|
| While the order by works using any combination of columns, by using the
| decode, it does not.
| A single colomn ordering (DECODE(:param,1,'1',2',2)) works tough.
|
| Any ideas ?
|
| (the goal is to order trough multiple columns using a parameter
| specfying the order type.
|

col order noprint new_value order
select DECODE(:param,1, '1, 3', 2, '1,4') order from dual;

then
...order by &order

Regards
Michel Cadot Received on Thu Nov 24 2005 - 13:12:14 CST

Original text of this message

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