Re: Exponential puzzler

  • From: Stephane Faroult <sfaroult@xxxxxxxxxxxx>
  • To: Lee.Robertson@xxxxxxxxxx
  • Date: Mon, 27 Feb 2012 14:38:13 +0100

On 02/27/2012 02:06 PM, Robertson Lee - lerobe wrote:
> Guys,
>
>
> Anyone had to convert an exponential number to a proper decimal number ?
>
>
>
> Ive got a varchar2 field which holds an exponential number as a string
> and need to get it out as a real number....
>
>
>
> e.g
>
>
>
> select popularity from lee1;
>
>
>
> returns
>
>
>
> 8.912655903259292E-5
>
>
>
> I would have thought a simple
>
>
>
> select to_number(popularity) from lee1;
>
>
>
> would work but it returns exactly the same.
>
>
>
> I know I can format it in SQL*Plus but this is actually part of an
> application and I need to update a table with the numeric value of the
> exponential string.
>
>
>
> TIA
>
>
>
> Lee
>
>
Lee,

    Don't mistake the representation and the actual value. Once you have 
applied "to_number()", it has become a number, and therefore you have 
what you need for your update. If you want to *show*  it differently, 
then it's a pure formatting (and conversion to varchar2) question.
It's exactly the same story as with dates - even if a date doesn't 
display the way you want, it doesn't mean that inside Oracle it's not 
what it should be.

The exponential notation is just the best way to maximize the 
information displayed while minimizing the number of digits ...

HTH,

-- 
Stephane Faroult
RoughSea Ltd <http://www.roughsea.com>
Konagora <http://www.konagora.com>
RoughSea Channel on Youtube <http://www.youtube.com/user/roughsealtd>


--
//www.freelists.org/webpage/oracle-l


Other related posts: