DB2 SQL Errors Codes and Error Messages and Warnings from Error -532 to -534

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-532, SQLSTATE=23504, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE RELATIONSHIP constraint-name
RESTRICTS THE DELETION OF ROW
WITH RID X rid-number
Explanation: A DELETE operation attempted to delete
a specified parent row in the object table and all related
descendent rows in the descendent tables. However, a
delete rule of RESTRICT or NO ACTION was specified
for one or more descendent tables.
A row of the table cannot be deleted because it has a
dependent in a relationship with a delete rule of
RESTRICT or NO ACTION or the deletion cascades to
a row which is a dependent in a relationship with a
delete rule of RESTRICT or NO ACTION.
If the statement that failed is an ALTER TABLE with
ALTER PART ROTATE FIRST TO LAST, then there is a
referential constraint that is defined with DELETE
RESTRICT on the table, and the data in the partition
that is to be reused cannot be deleted because of the
referential constraint.
System action: The DELETE statement cannot be
executed. The contents of the object table are
unchanged.
Programmer response: Examine the delete rule for all
descendent tables to determine the cause of the
problem. The specific tables involved can be
determined from the relationship constraint-name. The
specific descendent row is known by RID X rid-number.
SQLSTATE: 23504

Error: DB2 SQL Error: SQLCODE=-533, SQLSTATE=21501, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
INVALID MULTIPLE-ROW INSERT
Explanation: An INSERT operation with a subselect
attempted to insert multiple rows into a self-referencing
table.
The subselect of the INSERT operation should return
no more than one row of data.
System action: The INSERT statement cannot be
executed. The contents of the object table are
unchanged.
Programmer response: Examine the search condition
of the subselect to make sure that no more than one
row of data is selected.
SQLSTATE: 21501

Error: DB2 SQL Error: SQLCODE=-534, SQLSTATE=21502, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE PRIMARY KEY CANNOT BE
UPDATED BECAUSE OF
MULTIPLE-ROW UPDATE
Explanation: An UPDATE operation attempted to
update a primary key on multiple rows of the object
table.
An UPDATE statement updating the primary key
cannot be used to update more than one row of the
object table.
Note: This SQLCODE will only be issued for plans and
packages bound prior to Version 5. SQLCODE -534 will
not be issued for dynamic SQL or plans and packages
bound with Version 5 or later releases.
System action: The UPDATE statement cannot be
executed. The contents of the object table are
unchanged.
Programmer response: Examine the search condition
of the UPDATE statement to make sure that no more
than one row of the object table is selected to be
updated.
SQLSTATE: 21502

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