DB2 SQL Errors Codes and Error Messages and Warnings from Error -117 to -119

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-117, SQLSTATE=42802, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE NUMBER OF VALUES ASSIGNED
IS NOT THE SAME AS THE NUMBER
OF SPECIFIED OR IMPLIED
COLUMNS
Explanation: The number of insert values in the value
list of the insert operation is not the same as the
number of object columns specified. Alternatively, the
number of values on the right side of an assignment in
a SET assignment statement or the SET clause of an
update operation does not match the number of
columns on the left side.
System action: The statement cannot be executed. No
data was inserted into the object table.
Programmer response: Correct the statement to
specify one and only one value for each of the specified
object columns.
SQLSTATE: 42802

Error: DB2 SQL Error: SQLCODE=-118, SQLSTATE=42902, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE OBJECT TABLE OR VIEW OF
THE DELETE OR UPDATE
STATEMENT IS ALSO IDENTIFIED IN
A FROM CLAUSE
Explanation: The table or view specified as the object
of a DELETE or UPDATE statement also appears in the
FROM clause of a subselect within the statement.
The table or view that is the object of a UPDATE or
DELETE cannot also be used to supply the values to be
inserted or to qualify the rows to be updated or
deleted.
System action: The statement cannot be executed. No
data was updated or deleted.
Programmer response: The implied function is not
supported by DB2. It may be possible to obtain the
desired result by creating a temporary copy of the
object table or view and addressing the subselect to
that copy. Refer to chapter 2 of SQL Reference for
information about the syntax of SQL statements.
SQLSTATE: 42902

Error: DB2 SQL Error: SQLCODE=-119, SQLSTATE=42803, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
A COLUMN OR EXPRESSION IN A
HAVING CLAUSE IS NOT VALID
Explanation: A column or expression identified in a
HAVING clause, possibly within a scalar function, does
not appear in the GROUP BY clause. Columns or
expressions specified in a HAVING clause must appear
within aggregate functions or also be specified in the
GROUP BY clause.
Grouping expressions can be used in a search condition
in a HAVING clause. A grouping expression specifies
only one value for each group. A grouping expression
specified in this context must exactly match a grouping
expression specified in the GROUP BY clause, with the
exception of blanks, which are not significant.
System action: The statement cannot be executed.
Programmer response: The implied function is not
supported by DB2. Refer to chapter 4 of SQL Reference
for information about the proper usage of HAVING
and GROUP BY clauses.
SQLSTATE: 42803

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