Re: Get Count of Decimal Places

From: joel garry <joel-garry_at_home.com>
Date: Thu, 13 Mar 2008 11:20:31 -0700 (PDT)
Message-ID: <331faf3e-ccb6-430f-a472-8791b7944157@s13g2000prd.googlegroups.com>


On Mar 13, 10:55 am, webtourist <webtour..._at_gmail.com> wrote:
> I have some number data in table like this:
>
> .050485436893203883495145631
> 234.040388349514563106796116505
>
> i.e. very large decimal places..
>
> I'd like to update them and ROUND them all to 8th decimal.
>
> How to get the number of decimal places ? or I have to do this via
> to_char, substr etc....
>
> thanks

Oracle has a particular definition for storing numeric values. Normally, one keeps the value precisely, then rounds particularly during manipulation or display. But you might have some particular requirement, so perhaps you should say what it is. I've seen quite a bit of ridiculous argument as users don't understand when and where rounding should be done, especially when they have wrong formulae with Excel spreadsheets, and it always winds up coming back to me to explain why the db is right and their spreadsheets are wrong.

SQL has a round function:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions135.htm#sthref1966

The Concepts manual explains your options: http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#sthref3810

The SQL manual also describes the datatype in more detail: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements001.htm#sthref87

You should learn to search the manuals at http://tahiti.oracle.com

jg

--
@home.com is bogus.  '...unsolicited suggestions you "feel are
helpful" are helpful only to your sense of superiority.
You're not alone in this, either. Your "helping" impulse and your
sister's resistance both originate in the same human need: to matter.
The only way you're going to change this habit is to know this impulse
for what it is. Recognize it so you can be more conscious of the ways
you choose to assert yourself, and do so only when it's your business
to (the oversimplified version: when it's about you; when you're
asked; in emergencies). That's the only time it's appropriate, and
also, conveniently, the only time it actually works.
Put your "nitpicking" to that test and I think you'll see how freely,
and wrongly, your attempts to help have crossed these boundaries. This
is the light that will show you the limits next time. ' - "Carolyn
Hax"
Received on Thu Mar 13 2008 - 13:20:31 CDT

Original text of this message