Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL Query (Sorting)

Re: SQL Query (Sorting)

From: Arun Aggarwal <arun_at_ggn.aithent.com>
Date: Wed, 07 Feb 2001 23:30:48 -0800
Message-ID: <F001.002AE956.20010207231023@fatcity.com>

select
decode(substr(col1,1,1),'+',substr(col1,2,1)||'+','-',substr(col1,2,1)||'-', col1) from test
order by
to_number(decode(substr(col1,1,1),'+',substr(col1,2,1),'-',substr(col1,2,1), col1))
/

This will do the thing

Regards
Arun Aggarwal
Aithent Technologies (P) Ltd.
arun_at_ggn.aithent.com
+91-11-6920905 (35)

"If I knew what I was so anxious about, I wouldn't be so anxious." --Mignon McLaughlin

> Hi,
>
> I have a table with a field aa. It is varchar2(2). The possible values
> of this field are
> 1
> 2,-2,+2
> 3,-3,+3
> 4,-4,+4
> 5,-5,+5
> 6,-6,+6
> 7,-7,+7
> 8
> 9
> 10
>
> Now I have to make a query with order by aa . The records should be
> fetched in the following order
>
> 1, 2+,2,2-, 3+,3,3-, 4+,4,4-, 5+,5,5-, 6+,6,6-, 7+,7,7-, 8 , 9 , 10
>
> Can anyone help?
>
> Thanks in advance
>
> sivak
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Arun Aggarwal
  INET: arun_at_ggn.aithent.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Feb 08 2001 - 01:30:48 CST

Original text of this message

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