DB2 SQL Errors Codes and Error Messages and Warnings from Error -224 to -227

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-224, SQLSTATE=24512, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE RESULT TABLE DOES NOT
AGREE WITH THE BASE TABLE
USING cursor-name
Explanation: DB2 attempted a positioned UPDATE or
DELETE was attempted on a row that no longer
matches its previous condition. The column values in
the result table row do not match the current values in
the base table row because the row was updated
between the time it was inserted into the result table
and the positioned update or delete was executed.
cursor-name
Name of the cursor used for the positioned
update or delete.
System action: The statement cannot be processed.
The cursor is positioned on the same row.
Programmer response: Correct the application
program to handle this error condition or change
isolation levels so the base row cannot be updated
during the cursor operation.
SQLSTATE: 24512

Error: DB2 SQL Error: SQLCODE=-225, SQLSTATE=42872, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
FETCH STATEMENT FOR cursor-name
IS NOT VALID FOR THE
DECLARATION OF THE CURSOR
Explanation: DB2 could not process a FETCH
statement for cursor cursor-name because it contained a
disallowed keyword. One of the following errors have
occurred:
v A FETCH statement for a non-scrollable cursor
specified one of the keywords PRIOR, FIRST, LAST,
ABSOLUTE, RELATIVE, CURRENT, BEFORE, or
AFTER. These keywords are disallowed for a cursor
that was not declared with the SCROLL attribute,
however, the CURRENT clause is allowed with a
non-scrollable cursor only when combined with the
CONTINUE clause.
v CONTINUE was specified on the FETCH statement,
but the specified cursor was opened for a
multiple-row fetch operation. This combination is not
supported.
System action: The statement cannot be processed. No
data was written to the output host variables.
Programmer response: If a scrolling option was
specified on the FETCH statement for a non-scrollable
cursor, correct the FETCH statement to exclude the
disallowed keyword, or, correct the DECLARE
CURSOR statement to include the appropriate SCROLL
option. If the CONTINUE clause was specified for a
multiple-row cursor, change the application to use
single row fetch for this cursor. If multiple-row fetch is
required, use another technique, such as a LOB locator
for retrieving large LOB or XML values.
SQLSTATE: 42872

Error: DB2 SQL Error: SQLCODE=-227, SQLSTATE=24513, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
FETCH fetch-orientation IS NOT
ALLOWED, BECAUSE CURSOR
cursor-name HAS AN UNKNOWN
POSITION (sqlcode,sqlstate)
Explanation: The cursor position for cursor-name is
unknown. The previous multiple-row FETCH for
cursor cursor-name resulted in an error (SQLCODE
sqlcode, SQLSTATE sqlstate) in the middle of processing
multiple rows that were retrieved from DB2. One or
more of the requested rows could not be returned to
the program following the error, leaving the position of
the cursor unknown.
If an indicator structure had been provided on the
previous multiple-row FETCH, a positive SQLCODE
would have been returned and all of the rows that
were retrieved from DB2 could have been returned to
the application program.
System action: The statement cannot be processed.
The cursor position is not changed.
Programmer response: Close and reopen the cursor to
reset the position. For scrollable cursors, you can
change the FETCH statement to specify one of the
other fetch orientations (such as FIRST, LAST, BEFORE,
AFTER, or ABSOLUTE) to establish a valid cursor
position and fetch a row of data.
SQLSTATE: 24513

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