DB2 SQL Errors Codes and Error Messages and Warnings from Error -404 to -406

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-404, SQLSTATE=22001, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE SQL STATEMENT SPECIFIES A
STRING THAT IS TOO LONG
Explanation: An INSERT, UPDATE, MERGE, CALL,
VALUES INTO, SET, parameter, host variable, or
transition variable statement specifies a value that is
longer than the maximum length string that can be
stored in the target column or index key.
System action: The statement cannot be executed.
Programmer response:
Check the length of the target column, parameter, host
variable, transition variable, or index key and correct
the program or SQL statement so that the length of the
string does not exceed that maximum. For example,
you could use the SUBSTR function to shorten the
string.
SQLSTATE: 22001

Error: DB2 SQL Error: SQLCODE=-405, SQLSTATE=42820, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE NUMERIC CONSTANT constant
CANNOT BE USED AS SPECIFIED
BECAUSE IT IS OUT OF RANGE
Explanation:
The numeric constant is not in the proper range.
The proper ranges for SQL values are as follows:
v 5.4E-79 to 7.2E+75 for FLOAT values
v -(1031 -1) to +(1031 -1) for DECIMAL values
v -2147483648 to 2147483647 for INTEGER values
v -32768 to +32767 for small integer (SMALLINT)
values
v -9.999999999999999×10-383 to 9.999999999999999×10384
for DECFLOAT(16) values
v -9.999999999999999999999999999999999×10-6143 to
9.999999999999999999999999999999999×106144 for
DECFLOAT(34) values
v – 9223372036854775808 to +9223372036854775807 for
big integer (BIGINT) values
System action: The statement cannot be executed.
Programmer response: The value of constant should
be reduced to the appropriate size for this data type.
SQLSTATE: 42820

Error: DB2 SQL Error: SQLCODE=-406, SQLSTATE=22003, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
A CALCULATED OR DERIVED
NUMERIC VALUE IS NOT WITHIN
THE RANGE OF ITS OBJECT
COLUMN
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:
v The values occurring in the object column were out
of range.
v The SQL operation performed was not appropriate
for the values in the object column.
v A DECIMAL(19,0) column is altered to BIGINT, but a
value in the column is outside the range of BIGINT.
Refer to the ALTER TABLE description in SQL
Reference for more information.
System action: The statement cannot be executed.
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,
change the column back to DECIMAL(19,0) and refer to
the ALTER TABLE description in SQL Reference on how
to properly prepare for changing DECIMAL(19,0)
column to BIGINT.
SQLSTATE: 22003

Above are list of DB2 SQL Errors and Warnings from Error -404 to -406 received while performing certain operation against DB2 Database or related products.

SQLCODE – Regardless of whether the application program provides an SQLCA or a stand-alone variable, SQLCODE is set by DB2 after each SQL statement is
executed. DB2 conforms to the ISO/ANSI SQL standard as follows:
If SQLCODE = 0, execution was successful.
If SQLCODE > 0, execution was successful with a warning.
If SQLCODE < 0, execution was not successful.
SQLCODE = 100, “no data” was found. For example, a FETCH statement returned no data because the cursor was positioned after the last row of the result table.

SQLSTATE – SQLSTATE is also set by DB2 after the execution of each SQL statement. Thus, application programs can check the execution of SQL statements by testing SQLSTATE instead of SQLCODE.

Hope this was helpful.

Thanks,
SQLServerF1 Team
Information about DB2 SQL Error Codes and Error Messages on Windows, Linux and Z/OS Operating Systems.

 

Leave a Reply

Your email address will not be published. Required fields are marked *