DB2 SQL Errors Codes and Error Messages and Warnings from Error -220 to -222

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-220, SQLSTATE=55002, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE COLUMN column-name IN
EXPLANATION TABLE table-name IS
NOT DEFINED PROPERLY
Explanation: An error occurred during the insertion of
a row into the explanation table. The table is
improperly defined for the following reasons:
v A column is missing.
v Columns are defined in the wrong order.
v The table contains an extra column.
v A column description is invalid because of its name,
data type, length, or null attributes.
System action: The statement cannot be executed. The
explanation information is not generated.
Programmer response: Correct the definition of the
required explanation table. Refer to chapter 2 of SQL
Reference for information on defining an explanation
table.
SQLSTATE: 55002

Error: DB2 SQL Error: SQLCODE=-221, SQLSTATE=55002, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
“SET OF OPTIONAL COLUMNS” IN
EXPLANATION TABLE table-name IS
INCOMPLETE. OPTIONAL COLUMN
column-name IS MISSING
Explanation: The EXPLAIN statement assumes the
required explanation table is defined properly. The
optional column indicated is not defined in the
indicated explanation table. PLAN_TABLEs must have
one of several specific formats. The format chosen must
be complete, and each column in the PLAN_TABLE
definition must be correct for the chosen format. The
allowed formats for the PLAN_TABLE are described in
Chapter 6 of SQL Reference.
System action: The explanation information is not
generated.
Programmer response: Correct the definition of the
required explanation table to include all of the optional
columns in the chosen format, just the Version 2
Release 2 optional columns, or no optional columns.
Refer to chapter 2 of SQL Reference for information on
defining an explanation table.
SQLSTATE: 55002

Error: DB2 SQL Error: SQLCODE=-222, SQLSTATE=24510, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
AN UPDATE OR DELETE OPERATION
WAS ATTEMPTED AGAINST A HOLE
USING CURSOR cursor-name
Explanation: DB2 could not process a positioned
update or delete with cursor cursor-name that is defined
as SENSITIVE STATIC. The application program
attempted to execute an UPDATE or DELETE WHERE
CURRENT OF cursor statement at a time when the
specified cursor was positioned on a row of the object
table that is a hole. Each row that the cursor is
positioned on, that is to be updated or deleted must
not be a hole:
v An update hole occurs when the corresponding row of
the underlying table has been updated, and the
updated row no longer satisfies the search condition
that is specified in the SELECT statement of the
cursor.
v A delete hole occurs when the corresponding row of
the underlying table has been deleted.
This error might be issued if the following situations
occur:
v If the cursor is not a rowset cursor, then the row
corresponding to the current cursor position is either
an update hole, or a delete hole. DB2 detects these
holes when DB2 tries to update or delete the current
row of the result table for the cursor cursor-name, and
cannot locate the corresponding row of the
underlying table.
v If the cursor is a rowset cursor, then a row
corresponding to a row of the current rowset cursor
position is either an update hole or a delete hole.
DB2 detects these holes when DB2 tries to update or
delete the current row of the result table for cursor
cursor-name, and cannot locate the corresponding row
or rows of the underlying table.
System action: The statement cannot be processed. No
data was updated or deleted, and the cursor position is
unchanged.
Programmer response: Correct the logic of the
application program to ensure that the cursor is
correctly positioned on the intended row or rows of the
object table, and that the intended rows are not holes,
before the DELETE or UPDATE statement is executed.
v If the cursor is not a rowset cursor, then issue a
FETCH statement to position the cursor on a row
that is not a hole. Then, reissue the UPDATE or
DELETE statement.
v If the cursor is a rowset cursor, and is also the
positioned UPDATE or DELETE statement intended
to affect a single row corresponding to the rows of
the current rowset cursor position (this means for a
FOR ROW n of ROWSET clause was specified), then
change the UPDATE or DELETE statement to process
the rows that are not holes, one at a time.
v If the cursor is a rowset cursor, and is also the
positioned UPDATE or DELETE statement intended
to affect all rows corresponding to the rows of the
current rowset cursor position (this means for a FOR
ROW n of ROWSET clause was not specified), then
change the UPDATE or DELETE statement to process
the rows that are not holes, one at a time. Add a
FOR ROW n of ROWSET clause to the UPDATE or
DELETE statement to indicate which row of the
cursor is to be updated or deleted.
SQLSTATE: 24510

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