DB2 SQL Errors Codes and Error Messages and Warnings from Error -621 to -624
Error: DB2 SQL Error: SQLCODE=-621, SQLSTATE=58001, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
DUPLICATE DBID dbid WAS
DETECTED AND PREVIOUSLY
ASSIGNED TO database-name
Explanation: The current database being created was
assigned a DBID of ‘dbid’, which is identical to the
DBID assigned to database ‘database-name’. An
inconsistency exists between the DB2 catalog and
System action: The statement cannot be executed. No
new object was created, and the existing object was not
altered or modified.
System programmer response: If you suspect an error
in DB2, refer to Part 2 of Diagnosis Guide and Reference
for information on identifying and reporting the
Programmer response: Notify the system programmer.
The inconsistency must be corrected before CREATE
DATABASE will be successful.
Error: DB2 SQL Error: SQLCODE=-622, SQLSTATE=56031, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
FOR MIXED DATA IS INVALID
BECAUSE THE MIXED DATA INSTALL
OPTION IS NO
Explanation: FOR MIXED DATA is specified in a
column description of a CREATE or ALTER TABLE, a
CREATE FUNCTION, or a CREATE PROCEDURE
statement, but the MIXED DATA install option is set to
NO. FOR MIXED DATA is valid only when the MIXED
DATA install option is set to YES.
System action: The statement is not executed.
Programmer response: Either change the install option
or the FOR clause. If the install option is correctly set to
NO, the allowable FOR clause options are BIT and
Error: DB2 SQL Error: SQLCODE=-623, SQLSTATE=55012, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
A CLUSTERING INDEX ALREADY
EXISTS ON TABLE table-name
Explanation: A given table can have only one cluster
index. This error can occur for the following reasons:
v A CREATE INDEX statement would create a second
cluster index on the specified table.
v An ALTER INDEX statement specified the CLUSTER
clause, but there is already a clustering index defined
for the table.
System action: The statement cannot be executed.
Programmer response: Check to determine the
identity and validity of the existing cluster index on the
object table. Alternatively, consider creating the index
without the CLUSTER attribute.
Error: DB2 SQL Error: SQLCODE=-624, SQLSTATE=42889, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
TABLE table-name ALREADY HAS A
PRIMARY KEY OR UNIQUE
CONSTRAINT WITH SPECIFIED
Explanation: The code is used to report that a primary
key or unique key cannot be defined in an ALTER
TABLE statement because the table either:
v Already has a primary key, or
v Has an existing unique constraint with the same
definition (same set of columns specified) as the new
System action: The statement cannot be run.
Programmer response: Do not attempt to define a
table with more than one primary key, or a unique
constraint that duplicates the definition of an existing
Above are list of DB2 SQL Errors and Warnings from Error -621 to -624 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.