DB2 SQL Errors Codes and Error Messages and Warnings from Error -248 to -250

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-248, SQLSTATE=24521, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
A POSITIONED DELETE OR UPDATE
STATEMENT FOR CURSOR cursor-name
SPECIFIED ROW n OF A ROWSET,
BUT THE ROW IS NOT CONTAINED
WITHIN THE CURRENT ROWSET
Explanation: The FOR ROW n OF ROWSET clause
was specified on a positioned DELETE or UPDATE
statement, but row n is not contained within the bound
of the rowset. This situation can also occur when row n
is within the bounds of the rowset that was requested,
but the current rowset contains less than the requested
number of rows. In this case, a partial rowset is
returned. A partial rowset can occur for various
reasons, including an end of data condition or an error
that did not result in the closure of the cursor.
System action: The statement cannot be processed.
Programmer response: Reissue the positioned
UPDATE or DELETE with a value that corresponds to
a row of the current rowset. If the row that is specified
is outside of the current rowset, then do the following:
v Use the FOR n ROWS clause on a FETCH CURRENT
ROWSET statement to specify that the rowset
contains a larger number of rows
v Reissue the positioned UPDATE or DELETE
statement.
If this message is issued because a partial rowset was
returned,
v Update the application logic to detect that the actual
rowset size was less than the rowset size that was
requested
v Ensure that a positioned UPDATE or DELETE
statement only refers to rows of the current rowset.
SQLSTATE: 24521

Error: DB2 SQL Error: SQLCODE=-249, SQLSTATE=24523, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
DEFINITION OF ROWSET ACCESS
FOR CURSOR cursor-name IS
INCONSISTENT WITH THE FETCH
ORIENTATION CLAUSE clause
SPECIFIED
Explanation: A clause specified for the FETCH
statement is inconsistent with the definition of the
cursor cursor-name. This error can be issued for the
following situations:
v A cursor defined WITHOUT ROWSET
POSITIONING can only use BEFORE, AFTER, row
positioned fetch orientation keywords: NEXT, PRIOR,
FIRST, LAST, CURRENT, ABSOLUTE, or RELATIVE.
v A cursor defined WITH ROWSET POSITIONING can
use BEFORE, AFTER, rowset positioned fetch
orientation clauses: NEXT ROWSET, PRIOR
ROWSET, FIRST ROWSET, LAST ROWSET,
CURRENT ROWSET, or ROWSET STARTING AT, or,
row positioned fetch orientation keywords: NEXT,
PRIOR, FIRST, LAST, CURRENT, ABSOLUTE, or
RELATIVE.
A FOR n ROWS clause was specified on a FETCH
statement, but the cursor is not defined for rowset
access.
System action: The statement cannot be processed.
Programmer response: Correct the fetch orientation,
remove the FOR n ROWS clause, or redefine the cursor.
SQLSTATE: 24523

Error: DB2 SQL Error: SQLCODE=-250, SQLSTATE=42718, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE LOCAL LOCATION NAME IS
NOT DEFINED WHEN PROCESSING
A THREE-PART OBJECT NAME
Explanation: A three-part object name (table, view, or
alias) cannot be used until the local location name is
defined.
System action: Install or reinstall the DB2 distributed
data facility (DDF) with a registered location name for
local DB2.
Programmer response: Define the local location name
and then retry the function.
SQLSTATE: 42718

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