DB2 SQL Errors Codes and Error Messages and Warnings from Error -170 to -173
Error: DB2 SQL Error: SQLCODE=-170, SQLSTATE=42605, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE NUMBER OF ARGUMENTS
SPECIFIED FOR function-name IS
Explanation: An SQL statement includes the scalar
function ‘function-name’ with either too many or too
System action: The statement cannot be executed.
Programmer response: Correct the statement. Refer to
Chapter 3 of SQL Reference for rules for each argument
of the scalar function function-name.
Error: DB2 SQL Error: SQLCODE=-171, SQLSTATE=42815, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE DATA TYPE, LENGTH, OR
VALUE OF ARGUMENT
argument-position OF function-name IS
Explanation: The data type, the length, or the value of
an argument of a scalar function is incorrect.
An integer that identifies the position of the
incorrect argument in the function invocation.
The name of the scalar function.
System action: The statement that contains the
function cannot be processed.
Programmer response: Correct the invocation of the
function, and reissue the statement.
Problem determination: If the encoding scheme is
EBCDIC or ASCII, a possible reason for this error is
that a character argument was specified for a built-in
function that expects a graphic argument, or a graphic
argument was specified for a built-in function that
expects a character argument. The UNICODE encoding
scheme supports the mixing of character and graphic
arguments, but EBCDIC and ASCII do not.
If the function is a string function, this code might be
issued if a string unit was required but not specified.
The string unit keywords are CODEUNITS16,
CODEUNITS32, and OCTETS.
Error: DB2 SQL Error: SQLCODE=-173, SQLSTATE=42801, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
UR IS SPECIFIED ON THE WITH
CLAUSE BUT THE CURSOR IS NOT
Explanation: The cursor is not a read-only cursor.
WITH UR can be specified only if DB2 can determine
that the cursor is read-only.
System action: Statement execution fails.
Programmer response: If the cursor is intended to be
read-only but is ambiguous, add the FOR FETCH
ONLY clause. If the cursor is updatable, change the
isolation level specified on the WITH clause.
Above are list of DB2 SQL Errors and Warnings from Error -170 to -173 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.
Information about DB2 SQL Error Codes and Error Messages on Windows, Linux and Z/OS Operating Systems.