DB2 SQL Errors Codes and Error Messages and Warnings from Error +252 to +335
Error: DB2 SQL Error: SQLCODE=+252, SQLSTATE=01659, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
A NON-ATOMIC statement
PROCESSED ALL REQUESTED ROWS,
WITH ONE OR MORE WARNING
Explanation: A non-atomic statement statement
successfully processed multiple rows of data. However,
one or more warning conditions occurred. Use GET
DIAGNOSTICS to obtain information about the
warning conditions that occurred.
System action: The statement was processed.
Programmer response: Analyze the warning
conditions to determine whether the statement should
be rolled back or not.
Error: DB2 SQL Error: SQLCODE=+304, SQLSTATE=01515, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
A VALUE WITH DATA TYPE data-type1
CANNOT BE ASSIGNED TO A HOST
VARIABLE BECAUSE THE VALUE IS
NOT WITHIN THE RANGE OF THE
HOST VARIABLE IN POSITION
position-number WITH DATA TYPE
Explanation: A FETCH or SELECT into a host variable
list or structure, position number position-number failed
because the host variable having data type data-type2
was not large enough to hold the retrieved value
having data type data-type1.
System action: The FETCH or SELECT could not
return the data for the indicated SELECT item, the
indicator variable is set to negative two (-2) to indicate
a null value returned. Processing continues.
Programmer response: Verify that table definitions are
current, and that the host variable has the proper data
type. See the explanation for SQLCODE -405 for ranges
of SQL data types.
Error: DB2 SQL Error: SQLCODE=+331, SQLSTATE=01520, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE NULL VALUE HAS BEEN
ASSIGNED TO A HOST VARIABLE
OR PARAMETER BECAUSE THE
STRING CANNOT BE CONVERTED
FROM source-ccsid TO target-ccsid.
REASON reason-code, POSITION
Explanation: A string had to be converted from
source-ccsid to target-ccsid and an error occurred during
the conversion. The position-number, if provided
(non-zero), is the ordinality of the host variable or
parameter in the SQLDA. See the description of
SQLCODE -331 for further information including the
meaning of the reason-code.
System action: The host variable is unchanged and its
indicator variable is set to -2 to indicate that a null
value is returned. Execution of the statement continues
as if the conversion error had not occurred.
Error: DB2 SQL Error: SQLCODE=+335, SQLSTATE=01517, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
DB2 CONVERTED A HOST
VARIABLE, PARAMETER, OR
COLUMN NUMBER var-num
var-name-or-num TO COLUMN NAME,
HOST VARIABLE, OR EXPRESSION
NUMBER col-name-or-num FROM from
ccsid TO to-ccsid, AND RESULTING IN
Explanation: A conversion error occurred during the
conversion of a string to a different coded character set.
One or more substitution characters have been placed
in the string during the conversion process.
System action: DB2 processes the statement
Programmer response: This warning can occur in two
v If trace for IFCID 136 or 168 is not active, DB2
processes the SQL statement, but used substitution
characters instead one or more characters as a result
of character conversion from from ccsid to to-ccsid. If
substitution is acceptable, no action is necessary. If
substitution is not acceptable, issue a ROLLBACK.
Ensure that data being provided to DB2 is
convertible from from ccsid to to-ccsid without data
v If trace for IFCID 136 or 168 is active, and the to-ccsid
token is an EBCDIC CCSID, and system parameter
UIFCIDS is OFF, then this warning is caused by the
conversion to EBCDIC CCSID for IFCID trace record.
Use GET DIAGNOSTICS to determine if the original
SQL string had any other warnings associated with
it. If GET DIAGNOSTICS returns no other warnings,
no action is required.
Above are list of DB2 SQL Errors and Warnings from Error +252 to +335 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.
Information about DB2 SQL Error Codes and Error Messages on Windows, Linux and Z/OS Operating Systems.