Troubleshooting
Problem
Db2 might return the error, "SQL0802N Arithmetic overflow or other arithmetic exception occurred. SQLSTATE=22003" while executing sum() function in V11.1 where it does not in V10.5.
Symptom
A SQL statement failed with SQL0802N Arithmetic overflow or other arithmetic exception occurred .
And the generated optimized statement was like the following example. It was different from the optimized statement with V10.5.
Example:
Original Statement:
------------------
SELECT ...
(SELECT SUM(T1.C1) FROM T1 WHERE T1.C2 = T2.C1)
...
(SELECT SUM(T1.C1) FROM T1 WHERE T1.C2 = T2.C1)
...
(SELECT SUM(T1.C1) FROM T1 WHERE T1.C2 = T2.C1)
...
) FROM T2
Nore:
The original statement has multiple subselect. They were rewritten to the following subselect using "group by".
Optimized Statement:
-------------------
SELECT ...
(SELECT
Q11.$C0
FROM
(SELECT
SUM(Q10.C1),
Q10."C2
FROM
(SELECT
Q9.C1,
Q9.C2
FROM
T1I AS Q9
) AS Q10
GROUP BY
Q10.C1
) AS Q11
WHERE
(Q11.C1 = Q8.C2)
) AS Q12
Log InLog in to view more of this document
Was this topic helpful?
Document Information
Modified date:
30 April 2025
UID
swg22011256