Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Wierd problem, max(column_name) gives different result than max(to_number(column_name))
If 1080101 has a leading space (or spaces) you will get this result since
'1044241' is greater than ' 1080101'.
tony wrote:
> I have a table that includes an equipment number (eqnum). It is a varchar
> field. When I do a
>
> select max(eqnum) I get 1044241
>
> when i do a
>
> select max(to_number(eqnum) I get 1080101
>
> the lengths are the same a
> SELECT max(eqnum), max(to_number(eqnum)), length(max(eqnum)),
> length(max(to_number(eqnum)))
> gives
> 1044241 1080101 7 7
>
> why the difference??
> isn't a number in a varchar field the same as a number in an integer field?
>
> respond to group or ramdan_at_mailexcite.com
Received on Mon Sep 21 1998 - 11:34:35 CDT