DB2 SQL Errors Codes and Error Messages and Warnings from Error -496 to -499

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-496, SQLSTATE=51033, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE SQL STATEMENT CANNOT BE
EXECUTED BECAUSE IT REFERENCES
A RESULT SET THAT WAS NOT
CREATED BY THE CURRENT SERVER
Explanation: The SQL statement cannot be executed
because the current server is different from the server
that called a stored procedure. The SQL statement can
be any of the following:
v ALLOCATE CURSOR
v DESCRIBE CURSOR
v FETCH (using an allocated cursor)
v CLOSE (using an allocated cursor)
System action: The statement cannot be executed.
Programmer response: Connect to the server that
called the stored procedure which created the result set
before running the SQL statement that failed.
SQLSTATE: 51033

Error: DB2 SQL Error: SQLCODE=-497, SQLSTATE=54041, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE MAXIMUM LIMIT OF INTERNAL
IDENTIFIERS HAS BEEN EXCEEDED
FOR DATABASE database-name
Explanation: The SQL statement cannot be executed
because an internal identifier limit has been exceeded
for the database. The cause of this error is due to one
of the following:
1. On a CREATE DATABASE statement, the limit of
65279 DBIDs has been exceeded.
2. For all other statements, the limit of 32767 OBIDs
has been exceeded for that database.
3. If the database is a WORKFILE database, then one
of the following reasons might apply:
v The number of tablespaces in the WORKFILE
database has exceeded the limit of 500.
v The number of indexes defined on declared
global temporary tables belonging to all agents
on the local DB2 member has exceeded the limit
of 10,000.
v The number of tables and triggers belonging to a
local agent exceeded the limit of 11,767. The
tables in the WORKFILE database include work
files, created global temporary tables, and
declared global temporary tables.
System action: The SQL statement cannot be executed.
Programmer response: Take the appropriate action as
described in the following cases:
1. In the case of a DBID limit being exceeded, DROP
all unused databases and issue a COMMIT.
2. In the case of an OBID limit being exceeded, DROP
all unused objects in the database and issue a
COMMIT, specify a different database or run the
MODIFY utility to reclaim unused OBIDs.
SQLSTATE: 54041

Error: DB2 SQL Error: SQLCODE=-499, SQLSTATE=24516, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
CURSOR cursor-name HAS ALREADY
BEEN ASSIGNED TO THIS OR
ANOTHER RESULT SET FROM
PROCEDURE procedure-name.
Explanation: An attempt was made to assign a cursor
to a result set using the SQL statement ALLOCATE
CURSOR and one of the following applies:
v The result set locator variable specified in the
ALLOCATE CURSOR statement has been previously
assigned to cursor cursor-name.
v Cursor cursor-name specified in the ALLOCATE
CURSOR statement has been previously assigned to
a result set from stored procedure procedure-name.
System action: The statement cannot be executed.
Programmer response: Determine if the target result
set named in the ALLOCATE CURSOR statement has
been previously assigned to a cursor.
If the result set has been previously assigned to cursor
cursor-name, then either choose another target result set
or call stored procedure procedure-name again and
reissue the ASSOCIATE LOCATOR and ALLOCATE
CURSOR statements.
If the result set has not been previously assigned to a
cursor, the cursor cursor-name specified in the
ALLOCATE CURSOR statement has been previously
assigned to some result set from stored procedure
procedure-name. You can not assign cursor cursor-name to
another result set, so you must specify a different
cursor name in the ALLOCATE CURSOR statement.
Correct the statements so that the exact syntax used to
specify the procedure name on the CALL statement be
the same as that on the ASSOCIATE LOCATOR and/or
DESCRIBE PROCEDURE. If an unqualified name is
used to CALL the procedure, the 1-part name must also
be used on the other statements. If the CALL statement
is made with a 3-part name, and the current server is
the same as the location in the 3-part name, the
ASSOCIATE LOCATOR or DESCRIBE procedure can
omit the location.
SQLSTATE: 24516

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