DB2 SQL Errors Codes and Error Messages and Warnings from Error -160 to -164

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-160, SQLSTATE=42813, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE WITH CHECK OPTION CLAUSE
IS NOT VALID FOR THE SPECIFIED
VIEW
Explanation: The WITH CHECK OPTION clause does
not apply to a view definition under the following
circumstances:
v The view is read-only (for example, the view
definition includes DISTINCT GROUP BY, or JOIN).
v The view definition includes a subquery.
v A view on which the specified view definition is
dependent has an INSTEAD OF trigger defined.
System action: The statement cannot be executed. The
specified view was not created.
Programmer response: Refer to chapter 2 of SQL
Reference for rules regarding use of the WITH CHECK
OPTION in view definitions.
SQLSTATE: 42813

Error: DB2 SQL Error: SQLCODE=-161, SQLSTATE=44000, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE INSERT OR UPDATE IS NOT
ALLOWED BECAUSE A RESULTING
ROW DOES NOT SATISFY THE VIEW
DEFINITION
Explanation: The WITH CHECK OPTION applies to
the view that is the object of the insert or update
operation. Consequently, all attempts to insert or
update rows in that view are checked to ensure that the
results will conform to the view definition.
System action: The statement cannot be executed. No
inserts or updates were performed, and the contents of
the object view (and underlying base table) remain
unchanged.
Programmer response: Examine the view definition to
determine why the requested insert or update
operation was rejected. Note that this may be a
data-dependent condition.
SQLSTATE: 44000

Error: DB2 SQL Error: SQLCODE=-164, SQLSTATE=42502, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
auth-id1 DOES NOT HAVE THE
PRIVILEGE TO CREATE A VIEW
WITH QUALIFICATION authorization-ID
Explanation: The authorization ID auth-id1 does not
have the authority necessary to create views with
qualifiers other than its own authorization ID.
Specifically, the attempt to create a view with qualifier
authorization-ID is rejected.
System action: The statement cannot be executed. The
specified view was not created.
Programmer response: Do not attempt to create views
with other than your own ID as a qualifier. Only an
authorization ID that holds ‘SYSADM’ or ‘DBADM’
authority can create views for other authorization IDs.
The DBADM privilege should be granted on any of the
databases that contain at least one of the tables on
which this CREATE VIEW is based.
SQLSTATE: 42502

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