DB2 SQL Errors Codes and Error Messages and Warnings from Error -309 to -311

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-309, SQLSTATE=22512, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
A PREDICATE IS INVALID BECAUSE
A REFERENCED HOST VARIABLE
HAS THE NULL VALUE
Explanation: The statement could not be processed
because a host variable appearing in a predicate such
as
column-name = host-variable
had the NULL value. Such a predicate is not permitted
when the host variable contains the NULL value even
though the object column might contain nulls.
System action: The statement cannot be executed.
Programmer response: Rebind the plan or package
containing the statement. The condition described is not
an error in DB2 Version 2 Release 3 and later releases.
SQLSTATE: 22512

Error: DB2 SQL Error: SQLCODE=-310, SQLSTATE=22023, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
DECIMAL HOST VARIABLE OR
PARAMETER number CONTAINS
NON-DECIMAL DATA
Explanation: DB2 received nondecimal data from
either an application (in the form of a host variable),
function or a stored procedure (in the form of a
parameter that was passed to or from function or a
stored procedure).
number Identifies either the host variable number (if
the message is issued as a result of a FETCH,
INSERT, UPDATE, MERGE, DELETE, SELECT,
VALUES INTO, or SET assignment statement),
or the parameter number (if the message is
issued as the result of the invocation of a
function, or a CALL statement).
System action: The statement cannot be processed.
Programmer response: Correct the application
program or stored procedure. Ensure that all decimal
variables or parameters contain valid System/370
packed decimal numbers.
SQLSTATE: 22023

Error: DB2 SQL Error: SQLCODE=-311, SQLSTATE=22501, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE LENGTH OF INPUT HOST
VARIABLE NUMBER position-number IS
NEGATIVE OR GREATER THAN THE
MAXIMUM
Explanation: When evaluated, the length specification
for input host string variable, whose entry in the
SQLDA is indicated by position-number, was negative
or greater than the maximum.
System action: The statement cannot be executed.
Programmer response: Correct the program to ensure
that the lengths of all host string variables are not
negative or that they are not greater than the maximum
allowed length.
SQLSTATE: 22501

Above are list of DB2 SQL Errors and Warnings from Error -309 to -311 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 *