Tags

, , , , , , , , ,

My Details

In your COBOL programs where you need to summarize the amounts from a table based on region and convert the amounts into different currency, you would create a DB2 cursor to group by all the rows within a region and multiple by the currency factor to get the Total amount (in new currency). Chances are that the Total amount might exceed the precision set by DB2. And at this point you will encounter this issue. You need to either correct the calculation used for amount or change the DB2 precision, so it can handle larger amounts.

The default for precision depends on the data type of numeric-expression:

31 for decimal floating-point
15 for floating-point and decimal
19 for big integer
11 for large integer
5 for small integer.

Explanation
A value derived or calculated during processing of the SQL statement was outside the range of the data type of its object column. This problem might have arisen for one of the following reasons:

The values occurring in the object column were out of range.
The SQL operation performed was not appropriate for the values in the object column.
A DECIMAL(19,0) column is altered to BIGINT, but a value in the column is outside the range of BIGINT.

System action
The statement cannot be processed.

Programmer response

See the explanation of SQLCODE -405 for allowed ranges for numeric data types.
If the error occurred while accessing a table column that was altered from DECIMAL(19,0) to BIGINT, alter the column data type back to DECIMAL(19,0) and refer description of the ALTER TABLE statement for information about how to change DECIMAL(19,0) columns to BIGINT.

SQLSTATE
22003

https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/codes/src/tpc/n406.html

https://stackoverflow.com/questions/20794417/db2-sql-updating-a-table-value

https://www.ibm.com/support/knowledgecenter/en/SSEPGG_9.7.0/com.ibm.db2.luw.sql.ref.doc/doc/r0000791.html

Advertisements