# RE: Exponential puzzler

From: Robertson Lee - lerobe <Lee.Robertson_at_acxiom.com>
Date: Mon, 27 Feb 2012 16:32:47 -0000
Message-ID: <F1A191B056E5E04EA2134D842F9396F82961253D_at_sunmsx01.Corp.Acxiom.net>

Thanks for all the responses folks, it would appear I misinterpreted the requirements and they merely wanted to take the text version and put it into a number column so to_number is absolutely fine J

Cheers

Lee

From: Stephane Faroult [mailto:sfaroult_at_roughsea.com] Sent: 27 February 2012 13:38
To: Robertson Lee - lerobe
Cc: oracle-l_at_freelists.org
Subject: Re: Exponential puzzler

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>

The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged.

If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.

If you have received this communication in error, please resend this communication to the sender and delete the original message or any copy of it from your computer system.

Thank You.

--

http://www.freelists.org/webpage/oracle-l Received on Mon Feb 27 2012 - 10:32:47 CST

Original text of this message