DB2 SQL Errors Codes and Error Messages and Warnings from Error -629 to 632

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-629, SQLSTATE: 42834, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
SET NULL CANNOT BE SPECIFIED
BECAUSE FOREIGN KEY name
CANNOT CONTAIN NULL VALUES
Explanation: The code SET NULL option of the
indicated FOREIGN KEY clause is invalid because no
column of the key allows null values. The 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: Change a column of the key to
allow null values or change the delete rule.
SQLSTATE: 42834

Error: DB2 SQL Error: SQLCODE=-631, SQLSTATE: 54008, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
FOREIGN KEY name IS TOO LONG OR
HAS TOO MANY COLUMNS
Explanation: This code is used to report that the sum
of the length attributes of the columns identified in the
indicated FOREIGN KEY clause is greater than 255
bytes or the number of columns identified is greater
than 64. The ‘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 executed.
Programmer response: The table definition must be
modified to conform to the system-imposed limit of the
sum of the length attributes of the columns identified
in the PRIMARY KEY clause.
SQLSTATE: 54008

Error: DB2 SQL Error: SQLCODE=-632, SQLSTATE: 42915, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE TABLE CANNOT BE DEFINED
AS A DEPENDENT OF table-name
BECAUSE OF DELETE RULE
RESTRICTIONS
Explanation: This code is used to report that the
object of an ALTER TABLE statement cannot be defined
as a dependent of the indicated table because either:
v The relationship would form a cycle that would
cause the table to be delete-connected to itself.
v The relationship would cause the table to be
delete-connected to the indicated table through
multiple paths and the delete rule of the existing
relationship is SET NULL.
The error is due to the delete rules of existing
relationships, not the delete rule specified in the
FOREIGN KEY clause of the ALTER TABLE statement.
System action: The statement cannot be executed.
Programmer response: Eliminate the particular
FOREIGN KEY clause from the ALTER or CREATE
TABLE statement.
SQLSTATE: 42915

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