DB2 SQL Errors Codes and Error Messages and Warnings from Error -123 to -126

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-123, SQLSTATE=42601, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE PARAMETER IN POSITION n IN
THE FUNCTION name MUST BE A
CONSTANT OR KEYWORD
Explanation: The parameter in position n in the
function name is not a constant when it is required to
be a constant or a keyword when it is required to be a
keyword.
System action: The statement could not be processed.
Programmer response: Action: Ensure that each
argument of the function conforms to the definition of
the corresponding parameter.
SQLSTATE: 42601

Error: DB2 SQL Error: SQLCODE=-125, SQLSTATE=42805, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
AN INTEGER IN THE ORDER BY
CLAUSE DOES NOT IDENTIFY A
COLUMN OF THE RESULT
Explanation: The ORDER BY clause in the statement
contains a column number that is either less than one,
or greater than the number of columns of the result
table (the number of items in the SELECT clause).
System action: The statement cannot be executed.
Programmer response: Correct the syntax of the
ORDER BY clause such that each column identifier
properly denotes a column of the result table.
SQLSTATE: 42805

Error: DB2 SQL Error: SQLCODE=-126, SQLSTATE=42829, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE SELECT STATEMENT CONTAINS
BOTH AN UPDATE CLAUSE AND AN
ORDER BY CLAUSE
Explanation: The SELECT statement in the declaration
for a cursor contains both an UPDATE clause and an
ORDER BY clause. Unless you use a static sensitive
scrollable cursor, an ORDER BY clause cannot be
specified in the declaration for a cursor that is to be
used for UPDATE.
System action: The statement cannot be processed.
The cursor remains undefined in the application
program.
Programmer response: The implied function is not
supported by DB2. A cursor that is to be used for
update cannot be defined to fetch the rows of the object
table in a specific order.
Refer to chapter 4 of SQL Reference for information
about restrictions on the declarations for cursors to be
used for update.
SQLSTATE: 42829

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