Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ROUND(SUM()) works, but SUM(ROUND()) does not

DonbotNov 22 2010 — edited Nov 23 2010
This is being done on 10g Enterprise Edition 10.2.0.4.0.

I have a table with three columns: key1 (varchar2(10)), key2 (date), and the_value (number).
There are no nulls in any of the columns.

When I try this:
SELECT key1, key2, SUM(ROUND(the_value)) AS total_value FROM the_table GROUP BY key1, key2;
I get a Numeric Overflow exception.

However, when I try:
SELECT key1, key2, ROUND(SUM(the_value)) AS total_value FROM the_table GROUP BY key1, key2;
it works.

Any ideas why the first one would not? I don't see what would cause the first one to have a numeric overflow or underflow while the second one would not.

-- Don
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 21 2010
Added on Nov 22 2010
7 comments
10,924 views