DB2 SQL Errors Codes and Error Messages and Warnings from Error -526 to -531

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-526, SQLSTATE=42995, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE REQUESTED OPERATION OR
USAGE DOES NOT APPLY TO
table-type TEMPORARY TABLE
table-name
Explanation: DB2 assumes that the SQL statement
being executed refers to a created or declared temporary
table named table-name, and the requested operation or
usage in the statement is not allowed on the temporary
table.
table-type
CREATED or DECLARED
CREATED is for a temporary table defined by
the CREATE GLOBAL TEMPORARY TABLE
statement.
DECLARED is for a temporary table defined
by the DECLARE GLOBAL TEMPORARY
TABLE statement.
table-name
Qualified name of the temporary table.
System action: The statement cannot be processed.
Programmer response: Modify the SQL statement to
ensure that the object references are not to the indicated
type of temporary table, or if table-type is DECLARED
and you intended table-name to refer to an existing
persistent base table, you must perform one of the
following actions:
v Recreate the persistent base table table-name with a
different schema qualifier
v In the same application process, issue a DROP
TABLE for table name followed by a COMMIT to
drop the declared temporary table and afterwards be
able to reference the persistent base table with the
same table-name in the same application process
v Remove the DECLARE GLOBAL TEMPORARY
TABLE statement from the application process to use
the persistent base table with the same table-name
SQLSTATE: 42995

Error: DB2 SQL Error: SQLCODE=-530, SQLSTATE=23503, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE INSERT OR UPDATE VALUE OF
FOREIGN KEY constraint-name IS
INVALID
Explanation: An insert or update operation attempted
to place a value in a foreign key of the object table;
however, this value was not equal to some value of the
parent key of the parent table.
When a row is inserted into a dependent table, the
insert value of a foreign key must be equal to the value
of the parent key of some row of the parent table in the
associated relationship.
When the value of the foreign key is updated, the
update value of a foreign key must be equal to the
value of the parent key of some row of the parent table
of the associated relationship.
System action:
The UPDATE, MERGE, or INSERT statement cannot be
executed. The object table is unchanged.
Programmer response: Examine the insert or update
value of the foreign key first, and then compare it with
each of the parent key values of the parent table to
determine the cause of the problem.
SQLSTATE: 23503

Error: DB2 SQL Error: SQLCODE=-531, SQLSTATE=23504, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
PARENT KEY IN A PARENT ROW
CANNOT BE UPDATED BECAUSE IT
HAS ONE OR MORE DEPENDENT
ROWS IN RELATIONSHIP
constraint-name
Explanation: For plans and packages bound beginning
with Version 5 or dynamic SQL, a multi-row update of
a parent key attempted to remove a parent key value
on which a foreign key was dependent.
For plans and packages bound prior to Version 5 an
UPDATE operation attempted to update a primary key
in the specified row of the object table; however, the
primary key in the specified row had dependent rows
associated with it. The value of a primary key in a
parent row cannot be updated if the parent row has
any dependent rows.
System action: The UPDATE statement cannot be
executed. The object table is unchanged.
Programmer response: Examine the parent key of the
object table and the foreign key of the dependent table
to determine if the value of the specified row of the
parent key should be changed. If this does not expose
the problem, examine the contents of the object table
and the dependent table to determine the cause of the
problem.
SQLSTATE: 23504

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