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

Home -> Community -> Usenet -> c.d.o.server -> Re: how to sort numbers in varchar2

Re: how to sort numbers in varchar2

From: Jan <janik_at_pobox.sk>
Date: 7 Jul 2003 23:41:20 -0700
Message-ID: <81511301.0307072241.1e89f86f@posting.google.com>


If you have just positive numbers, you can use LPAD/RPAD for having equal length for all characters.
if you have mixture (positive and negative) - then there is no simple solution.
Jan

"Jim Kennedy" <kennedy-down_with_spammers_at_comcast.net> wrote in message news:<9tqOa.2065$wk6.1582_at_rwcrnsc52.ops.asp.att.net>...
> don't store numbers in character columns, store them in numeric columns.
> Jim
>
> "Susan Lam" <susana73_at_hotmail.com> wrote in message
> news:7186ed56.0307071524.17448526_at_posting.google.com...
> > I have a varchar2 column which stores characters as well as numbers in
> > string such as '12345'. I would like to sort the column so that it
> > orders by the actual number in the number string. However, if I do a
> > simple order by, 111 is smaller than 22. Is there a easy way to
> > accomplish this in sql instead of doing in programming?
> >
> > Thanks,
> > Susan
Received on Tue Jul 08 2003 - 01:41:20 CDT

Original text of this message

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