DB2 SQL Errors Codes and Error Messages and Warnings from Error -536 to -538
Error: DB2 SQL Error: SQLCODE=-536, SQLSTATE=42914, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE DELETE STATEMENT IS
INVALID BECAUSE TABLE table-name
CAN BE AFFECTED BY THE
Explanation: A DELETE operation with the indicated
table referenced in a subquery was attempted.
If ‘T’ is the object table of the DELETE, the indicated
table is one of the following:
v A dependent of ‘T’ in a relationship with a delete
rule of CASCADE or SET NULL
v A dependent of another table in a relationship with a
delete rule of CASCADE or SET NULL in which
deletions from ‘T’ can cascade to that table.
System action: The DELETE statement cannot be
processed. The contents of the object table are
Programmer response: Do not attempt to reference a
table in a subquery of a DELETE statement when the
table can be affected by the DELETE statement.
Error: DB2 SQL Error: SQLCODE=-537, SQLSTATE=42709, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE PRIMARY KEY, FOREIGN KEY,
UNIQUE, OR PARTITIONING KEY
CLAUSE IDENTIFIES COLUMN
column-name MORE THAN ONCE
Explanation: PRIMARY KEY, FOREIGN KEY,
UNIQUE, or PARTITIONING KEY can each be
followed by a list of column names. The statement
violates the rule that no column name can appear more
than once in any such list.
System action: The statement cannot be executed.
Programmer response: Correct the statement to
specify unique names for each column.
Error: DB2 SQL Error: SQLCODE=-538, SQLSTATE=42830, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
FOREIGN KEY name DOES NOT
CONFORM TO THE DESCRIPTION
OF A PARENT KEY OF TABLE
Explanation: The definition of the indicated foreign
key does not conform to the description of parent key
of the indicated table due to one of the following
v The referenced parent key has not been defined as a
primary key or a unique key.
v The keys do not have the same number of columns.
v The description of the keys are not identical. The
requirement for identical descriptions includes data
type, length attribute, and field procedure.
name is the constraint-name specified in the foreign key
clause or, if a constraint-name was not specified, the
first column-name specified in the clause.
System action: The statement cannot be processed.
Programmer response: Correct the statement so that
the description of the foreign key references a primary
key or unique key, or so that the description of the
foreign key conforms to that of a parent key of the
Above are list of DB2 SQL Errors and Warnings from Error -536 to -538 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.