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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Adding the pennies correctly

Re: Adding the pennies correctly

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Sun, 27 Jun 1999 21:13:35 +0100
Message-ID: <930514676.4136.0.nnrp-04.9e984b29@news.demon.co.uk>

It is possible that this is the result of rounding errors between internal and decimal representation which happens to cancel out over the full data set, but doesn't over the grouped set.

It would be interesting to try:

    sum(trunc(100 * amount))/100
group by district and see what happens.

--

Jonathan Lewis
Yet another Oracle-related web site: www.jlcomp.demon.co.uk

Ian Brown wrote in message <01bec0c9$fa045520$159793c3_at_default>...
>I have run two queries on a 5.8m record table. One verifies that the sum of
>the amount field [NUMERIC (14,2)] is £0.00. When I add a "District" field
>to the output and add GROUP BY the sum of the individual District totals is
>£0.03
>
>Can anyone tell me what is going on and, more importantly, how to properly
>report the District totals for a table that is in balance?
>
>Thanks in advance.
>
>Ian Brown
Received on Sun Jun 27 1999 - 15:13:35 CDT

Original text of this message

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