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 -> How to order strings as numbers

How to order strings as numbers

From: Guenther Ohlhausen <Guenther.Ohlhausen_at_iao.fhg.de>
Date: Tue, 03 Aug 1999 17:39:00 +0200
Message-ID: <37A70D14.8F4581C9@iao.fhg.de>


Hi everyone,

I've got two equal tables, except that the column 'dummy_n' is missing in table_a.I need to select the string '-INFINITY' as a pseudocolumn! In table_b, the datatype of dummy_n is number, and the values are in
(-1, 1). So I used TO_CHAR to get the same datatypes for the UNION.
(I Don't know who the hell designed these two tables.)

So I get the following:

select dummy1, dummy_2, ..., '-INFINITY' AS dummy_n from table_a union
select dummy1, dummy_2, ..., TO_CHAR(dummy_n) as dummy_n from table_b;

Now I need an ORDER BY dummy_n which orders like numbers, which means:

asc: 'INFINITY', '-1', '-.4', '0', '.2', '1' and viceversa desc.

thanks in advance.

--
Das Universum kennt keine Gesetze,
es hat nur Gewohnheiten!

Mit besten Gruessen / best regards

Guenther Ohlhausen Received on Tue Aug 03 1999 - 10:39:00 CDT

Original text of this message

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