Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Arithmatic overflow during a count(*) query

1,176 views
Skip to first unread message

Arun Srinivasan

unread,
May 20, 2009, 3:40:44 AM5/20/09
to
bculinp@prodbcuadmn01mgt:~/arun/year_of_service> db2 "select count(*)
from ccdb.year_of_service"

1
-----------
SQL0802N Arithmetic overflow or other arithmetic exception occurred.
SQLSTATE=22003

bculinp@prodbcuadmn01mgt:~/arun/year_of_service> db2 "select card from
syscat.tables where tabname='YEAR_OF_SERVICE'"

CARD
--------------------
2198695968

1 record(s) selected.


Whats happening? Is this a known bug that we have to typecast in case
the count gets greater than 1 BiL??

Salvatore Vacca

unread,
May 20, 2009, 5:07:25 AM5/20/09
to

The result of the ‘COUNT’ function is a large integer (INTEGER or INT)
32 bit; around 2^32/2.
Regards
Salvatore Vacca

rahul

unread,
May 20, 2009, 6:02:50 AM5/20/09
to

check the error description, self explanatory :

This error may also be returned when column functions cannot
handle the value that is returned by the SQL statement. For
example, issuing a SELECT COUNT statement against a table that
has more rows than defined by the MAX_LONGINT_INT SQL limit will
cause an arithmetic overflow error. Consider using the COUNT_BIG
column function for tables with more than 2 147 483 647 rows.

0 new messages