DB2 SQL Errors Codes and Error Messages and Warnings from Error -133 to -136

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-133, SQLSTATE=42906, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
AN AGGREGATE FUNCTION IN A
SUBQUERY OF A HAVING CLAUSE IS
INVALID BECAUSE ALL COLUMN
REFERENCES IN ITS ARGUMENT
ARE NOT CORRELATED TO THE
GROUP BY RESULT THAT THE
HAVING CLAUSE IS APPLIED TO
Explanation: If an aggregate function has a correlated
column reference, it must be correlated from within a
HAVING clause to the GROUP BY result that the
HAVING clause is applied to. All column references in
the argument must satisfy this condition.
System action: The statement cannot be executed.
Programmer response: Refer to chapter 4 of SQL
Reference for information about restrictions on the
syntax of the HAVING clause.
SQLSTATE: 42906

Error: DB2 SQL Error: SQLCODE=-134, SQLSTATE=42907, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
IMPROPER USE OF A STRING, LOB,
OR XML VALUE
Explanation: The SQL statement references a string,
LOB, or XML value that is not valid in the context that
was specified.
This error can be issued when the length attribute of a
string value is too long for the context in which it is
used. The string value that you specified is invalid for
one of the following reasons:
v A string value with a length attribute greater than
255 bytes is not allowed in a SELECT list that also
specifies DISTINCT.
v A string value with a length attribute greater than
255 bytes is not allowed for a string representation of
a number.
v A string value with a length attribute greater than
16000 bytes is not allowed for a sort operation such
as an ORDER BY clause.
v A string value with a length attribute greater than
32704 bytes is not allowed as an argument to the
REPLACE function.
This error can also be issued when LOB or XML values
are specified in a context in which they are not
allowed. The LOB or XML value that you specified is
invalid for one of the following reasons:
v A LOB or an XML value is not allowed in an ORDER
BY clause.
v A LOB or an XML value is not allowed in a check
constraint.
Attention: A token might be returned with the name of
the column or special register that resulted in the error.
The nature of the error and the syntax in which it
occurred determines whether a token is returned.
System action: The statement cannot be processed.
Programmer response: DB2 does not support the
requested operation on the string, LOB, or XML value.
Refer to SQL Reference for information about restrictions
on the specification and manipulation of string values.
SQLSTATE: 42907

Error: DB2 SQL Error: SQLCODE=-136, SQLSTATE=54005, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
SORT CANNOT BE EXECUTED
BECAUSE THE SORT KEY LENGTH
TOO LONG
Explanation: A sort key is derived from the list of
columns specified following a DISTINCT keyword, or
in an ORDER BY or GROUP BY clause in a query. If
both a DISTINCT keyword and an ORDER BY or
GROUP BY clause are present, the sort key is derived
from the combination of both lists of columns.
The internal length of the sort key cannot exceed 16000
bytes. In attempting to process the SQL statement, the
internal length of the sort key derived from the
DISTINCT and ORDER BY (or GROUP BY), or, the
DISTINCT or ORDER BY (or GROUP BY) specifications
was found to exceed that maximum limit.
The error can also occur for an ORDER BY specification
for the XMLAGG function. The internal length of the
sort key for XMLAGG cannot exceed 4000 bytes. In
attempting to process the XMLAGG function
invocation, the internal length of the sort key derived
from the ORDER BY specification was found to exceed
that maximum limit.
System action: The statement cannot be processed.
User response: The statement must be modified such
that the internal length of the sort key does not exceed
the maximum limit. In general, this means that one or
more column names must be deleted from the ORDER
BY or GROUP BY clause, or deleted from the list
following the DISTINCT keyword.
SQLSTATE: 54005

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