RPG (IBM i / AS/400) · DB2 SQLCODE
What does SQLCODE -802 - Arithmetic Exception mean in RPG (IBM i / AS/400)?
An SQL statement performed an arithmetic operation - commonly a division by zero, or a computation whose result overflowed the target column's or host variable's precision - while executing inside the SQLRPGLE program.
An SQL statement performed an arithmetic operation - commonly a division by zero, or a computation whose result overflowed the target column's or host variable's precision - while executing inside the SQLRPGLE program.
Guard division in the SQL statement (a CASE or NULLIF around the divisor) the same way you'd guard native RPG arithmetic, and size result columns/host variables large enough for the values the calculation can actually produce.