DB2 SQL Errors Codes and Error Messages and Warnings from Error -543 to -545

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-543, SQLSTATE=23511, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
A ROW IN A PARENT TABLE
CANNOT BE DELETED BECAUSE THE
CHECK CONSTRAINT check-constraint
RESTRICTS THE DELETION
Explanation: The delete operation cannot be executed
because the target table is a parent table and is
connected with a referential constraint to a dependent
table with a delete rule of SET NULL. However, a
check constraint defined on the dependent table
restricts the column from containing a null value.
System action: The DELETE statement was not
executed. The contents of the tables are unchanged.
Programmer response: Examine the foreign key and
its delete rule in the dependent table and the
conflicting check constraint. Change either the delete
rule or the check constraint so that they do not conflict.
SQLSTATE: 23511

Error: DB2 SQL Error: SQLCODE=-544, SQLSTATE=23512, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE CHECK CONSTRAINT
SPECIFIED IN THE ALTER TABLE
STATEMENT CANNOT BE ADDED
BECAUSE AN EXISTING ROW
VIOLATES THE CHECK
CONSTRAINT
Explanation: An existing row violates the check
constraint specified in the ALTER TABLE statement.
System action: The statement cannot be executed. The
check constraint definition is not added to the table.
The table definition is unchanged.
Programmer response: Examine the check constraint
definition that was specified in the ALTER TABLE
statement and the data in the table to determine why
the ALTER TABLE statement was rejected.
You can determine which rows violated the check
constraint by using the SELECT statement, negating the
check constraint in the WHERE clause. For example:
SELECT * FROM table WHERE (NOT (check-condition));
SQLSTATE: 23512

Error: DB2 SQL Error: SQLCODE=-545, SQLSTATE=23513, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE REQUESTED OPERATION IS
NOT ALLOWED BECAUSE A ROW
DOES NOT SATISFY THE CHECK
CONSTRAINT check-constraint
Explanation:
Check constraint violations occurred on an INSERT,
UPDATE, or MERGE statement. The resulting row
violated the check constraint definition on the table.
System action:
The INSERT, UPDATE, or MERGE statement cannot be
executed. The contents of the table are unchanged.
Programmer response: Examine the data and the
check constraint definition in the SYSIBM.SYSCHECKS
catalog table to determine why the INSERT, MERGE,
DELETE, or UPDATE statement was rejected. The data
must be changed to satisfy the check constraint.
SQLSTATE: 23513

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