Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> How to order strings as numbers
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
![]() |
![]() |