DB2 SQL Errors Codes and Error Messages and Warnings from Error -206 to -212

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
name IS NOT VALID IN THE
CONTEXT WHERE IT IS USED
Explanation: name is not valid in the context where it
was specified. This error can occur for the following
situations:
v The specified column is not a column of any of the
source or target tables or views of the statement.
– In a SELECT or DELETE statement, the specified
column is not a column of any of the tables or
views that are identified in a FROM clause in the
statement.
– A column list of an SQL data change statement
specified the name of a column of the target table
or view of the statement.
v A VALUES clause of an SQL data change statement
specified the name of a column of the target table.
v The left side of an assignment clause of an SQL data
change statement specified a column that is not a
column of the target table or view of the statement,
or an INCLUDE column defined for the statement.
For a DELETE statement, the target of an assignment
clause can only be an INCLUDE column.
v The right side of an assignment clause of an SQL
data change statement referenced an INCLUDE
column for expression. A column defined in an
INCLUDE clause can only be specified on the left
side of an assignment in an SQL data change
statement.
v A column defined in the INCLUDE clause of an
UPDATE or DELETE statement was referenced in the
WHERE clause of that statement.
v A qualified column name was specified, but the table
designator that is specified as the qualifier is not
defined in this context.
v For a GROUP BY clause, a correlated reference to a
column was specified for a grouping expression,
which is not allowed.
v For an ORDER BY clause, the specified column is a
correlated column reference in a subselect, which is
not allowed.
v A correlated reference to a column was specified in
an OLAP specification. Each column name that is
referenced in an OLAP specification must
unambiguously reference a column of the result table
of the subselect that contains the OLAP specification.
v For a CREATE TRIGGER statement,
– A reference is made to a column using an OLD or
NEW correlation name. The column name is not
defined in the triggering table.
– The left side of an assignment in the SET
transition-variable statement in the triggered
action specified an old transition-variable that is
not valid for the type of trigger.
– The reference name does not resolve to the name
of a column or transition-variable.
System action: The statement cannot be processed.
Programmer response: Verify that the column and
table designators are specified correctly in the SQL
statement. In the case of a SELECT statement, verify
that all of the required tables or views were named in
the FROM clause. If the column was intended to be a
correlated reference, qualify the column with the
correct table designator.
For an ORDER BY clause, ensure that there are no
correlated column references.
In the case of a CREATE TRIGGER statement, ensure
that only new transition variables are specified on the
left side of assignments in a SET transition-variable
statement and that any reference to columns of the
triggering table are qualified with a transition-variable
correlation name.
For a DELETE statement, ensure that only columns
defined in the INCLUDE clause are specified on the left
side of assignments.
SQLSTATE: 42703

Error: DB2 SQL Error: SQLCODE=-208, SQLSTATE=42707, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE ORDER BY CLAUSE IS INVALID
BECAUSE COLUMN name IS NOT
PART OF THE RESULT TABLE
Explanation: The statement is invalid because a
column (‘name’) specified in the ORDER BY list does
not appear in the result table (that is, it is not specified
in the SELECT-list). Only columns in the result table
can be used to order that result when the fullselect of
the select-statement is not a subselect.
System action: The statement cannot be executed.
Programmer response: Correct the syntax of the
statement, either by adding the specified column to the
result table, or deleting it from the ORDER BY clause.
Refer to chapter 4 of SQL Reference for information
about restrictions on the use of the ORDER BY clause
to order the result of an SQL SELECT.
SQLSTATE: 42707

Error: DB2 SQL Error: SQLCODE=-212, SQLSTATE=42712, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
name IS SPECIFIED MORE THAN
ONCE IN THE REFERENCING
CLAUSE OF A TRIGGER DEFINITION
Explanation: The REFERENCING clause of a CREATE
TRIGGER statement specified the same name for more
than one of the OLD or NEW correlation names or the
OLD_TABLE or NEW_TABLE identifiers. name is the
name that was specified multiple times.
System action: The statement cannot be executed. The
trigger was not created.
Programmer response: Change the statement to
specify unique names for all transition variables and
tables in the REFERENCING clause and resubmit the
CREATE TRIGGER request.
SQLSTATE: 42712

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