DB2 SQL Errors Codes and Error Messages and Warnings from Error -197 to -199

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-197, SQLSTATE=42877, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
A QUALIFIED COLUMN NAME IS
NOT ALLOWED IN THE ORDER BY
CLAUSE WHEN A SET OPERATOR IS
ALSO SPECIFIED
Explanation: The ORDER BY clause of a fullselect that
includes a set operator, such as UNION, EXCEPT, or
INTERSECT, cannot have qualified column names.
System action: The statement cannot be processed.
Programmer response: Change the statement to
ensure that all column names in the ORDER BY clause
are unqualified.
SQLSTATE: 42877

Error: DB2 SQL Error: SQLCODE=-198, SQLSTATE=42617, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE OPERAND OF THE PREPARE OR
EXECUTE IMMEDIATE STATEMENT
IS BLANK OR EMPTY
Explanation: The operand (host variable or string
constant) that was the object of the PREPARE or
EXECUTE IMMEDIATE statement either contained all
blanks or was an empty string. A DBRM built in
Version 2 Release 3 cannot be used on a Version 2
Release 2 system if the distributive functions were
used. If this error appears on Version 2 Release 2 and
the DBRM was built on Version 2 Release 3, then the
program needs to be precompiled again to correct the
problem.
System action: The statement cannot be executed.
Programmer response: Correct the logic of the
application program to ensure that a valid SQL
statement is provided in the operand of the PREPARE
or EXECUTE IMMEDIATE statement before that
statement is executed.
SQLSTATE: 42617

Error: DB2 SQL Error: SQLCODE=-199, SQLSTATE=42601, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
ILLEGAL USE OF KEYWORD keyword.
TOKEN token-list WAS EXPECTED
Explanation: A syntax error was detected in the
statement at the point where the keyword keyword
appears.
As an aid to the programmer, a partial list of valid
tokens is provided in SQLERRM as token-list. Only
those tokens that will fit are listed. Some tokens in the
list might not be valid in statements to be executed by
DB2; those tokens are valid for sending to other
database management systems.
System action: The statement cannot be executed.
Programmer response: Examine the statement in the
area of keyword keyword. A colon or SQL delimiter
might be missing.
Verify that the clauses are in the correct order. If the
reserved word that is identified in the messages is
listed as a reserved word, make the word a delimited
identifier. Refer to Appendix B of SQL Reference for a
detailed list of reserved words.
SQLSTATE: 42601

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