DB2 SQL Errors Codes and Error Messages and Warnings from Error -150 to -152

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-150, SQLSTATE=42807, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE OBJECT OF THE INSERT,
DELETE, UPDATE, MERGE, OR
TRUNCATE STATEMENT IS A VIEW,
SYSTEM-MAINTAINED
MATERIALIZED QUERY TABLE, OR
TRANSITION TABLE FOR WHICH
THE REQUESTED OPERATION IS
NOT PERMITTED
Explanation: One of the following occurred:
v A transition table was named in an INSERT,
UPDATE, DELETE, MERGE, or TRUNCATE
statement in a triggered action. Transition tables are
read-only.
v The view named in the INSERT, UPDATE, DELETE,
MERGE, or TRUNCATE statement is defined in such
a way that the requested insert, update, delete, or
truncate operation cannot be performed upon it.
Inserts into a view are prohibited if:
– The view definition contains a join, a GROUP BY,
or a HAVING clause.
– The SELECT clause in the view definition contains
the DISTINCT qualifier, an arithmetic expression,
a string expression, a built-in function, or a
constant.
– Two or more columns of the view are derived
from the same column.
– A base table of the view contains a column that
does not have a default value and is not included
in the view.
Updates to a view are prohibited if:
– The view definition contains a join, a GROUP BY,
or a HAVING clause.
– The SELECT clause in the view definition contains
the DISTINCT qualifier or a built-in function.
Also, a given column in a view cannot be updated
(that is, the values in that column cannot be
updated) if the column is derived from an arithmetic
expression, a constant, a column that is part of the
key of a partitioned index, or a column of a catalog
table that cannot be updated.
Deletes against a view are prohibited if:
– The view definition contains a join, a GROUP BY,
or a HAVING clause.
– The SELECT clause in the view definition contains
the DISTINCT qualifier or a built-in function.
Truncates against a view are always prohibited.
v An auxiliary table or an XML table was named in a
TRUNCATE statement.
System action: The statement cannot be executed. No
data was inserted, updated, deleted, merged, or
truncated.
User response: The requested function cannot be
performed on the view. Refer to chapter 2 of SQL
Reference for further information regarding inserting,
deleting, updating, and truncating views.
If the error occurred on a CREATE TRIGGER
statement, remove the INSERT, UPDATE, MERGE, or
DELETE reference to the transition table.
SQLSTATE: 42807

Error: DB2 SQL Error: SQLCODE=-151, SQLSTATE=42808, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE UPDATE OPERATION IS
INVALID BECAUSE THE CATALOG
DESCRIPTION OF COLUMN
column-name INDICATES THAT IT
CANNOT BE UPDATED
Explanation: The requested function is not supported
by DB2.
column-name
The name of the column that could not be
updated.
The specified column cannot be updated for one of the
following reasons:
v The values for columns occurring in the partitioning
key of a partitioned table cannot be updated.
v The object table is a view and the specified column is
defined (in the definition of the view) in such a way
that it cannot be updated.
v The object table is a catalog table with no columns
that can be updated.
v The object column is a ROWID column.
v The object column is defined with the AS ROW
CHANGE TIMESTAMP and GENERATED ALWAYS
attributes.
v The specified column of catalog tables cannot be
updated because the column itself is not updatable.
Individual columns in a view cannot be updated for
one of the following reasons:
v The column is derived from an SQL function, an
arithmetic expression, or a constant.
v The column is defined for a column of an underlying
view that cannot be updated.
v The column is defined for a read-only view.
v The column is defined for a column that is in the
partitioning key of a partitioned table.
System action: The statement was not executed. No
data was updated in the object table or view.
Programmer response: Refer to the description of the
UPDATE statement in SQL Reference for information
about restrictions on the ability to update ROWID
columns, identity columns, row change timestamp
columns, and columns in partitioned tables and views.
SQLSTATE: 42808

Error: DB2 SQL Error: SQLCODE=-152, SQLSTATE=42809, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE DROP clause CLAUSE IN THE
ALTER STATEMENT IS INVALID
BECAUSE constraint-name IS A
constraint-type
Explanation: The DROP clause of an ALTER TABLE
statement tried to drop a constraint that does not match
the constraint-type in the DROP clause. clause must
identify an appropriate constraint-type as follows:
REFERENTIAL CONSTRAINT
The identified constraint must be a referential
constraint.
CHECK CONSTRAINT
The identified constraint must be a check
constraint.
PRIMARY KEY CONSTRAINT
The identified constraint must be a primary
key constraint.
UNIQUE KEY CONSTRAINT
The identified constraint must be a unique key
constraint.
System action: The ALTER TABLE DROP statement
cannot be executed. No object was dropped.
Programmer response: Drop the existing object with
the correct DROP clause of the ALTER TABLE
statement.
SQLSTATE: 42809

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