DB2 SQL Errors Codes and Error Messages and Warnings from Error -518 to -525

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-518, SQLSTATE=07003, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE EXECUTE STATEMENT DOES
NOT IDENTIFY A VALID PREPARED
STATEMENT
Explanation: One of the following conditions exists:
v The statement named in the EXECUTE statement has
not been prepared.
v The statement named in the EXECUTE statement
identifies a SELECT, or ASSOCIATE LOCATORS
statement
v The statement named in the EXECUTE IMMEDIATE
statement identifies a SELECT or ASSOCIATE
LOCATORS statement.
System action: The statement cannot be executed.
Programmer response: Ensure that you prepare the
statement prior to EXECUTE. Also, ensure that the
statement you prepare is not a SELECT or VALUES
INTO statement.
SQLSTATE: 07003

Error: DB2 SQL Error: SQLCODE=-519, SQLSTATE=24506, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE PREPARE STATEMENT
IDENTIFIES THE SELECT
STATEMENT OF THE OPENED
CURSOR cursor-name
Explanation: The application program has attempted
to PREPARE (actually, re-PREPARE) the SELECT
statement for the specified cursor at a time when that
cursor was already open.
System action: The statement cannot be executed. The
cursor was not affected.
Programmer response: Correct the logic of the
application program so that it does not attempt to
re-PREPARE the SELECT statement for a cursor when
that cursor is open.
SQLSTATE: 24506

Error: DB2 SQL Error: SQLCODE=-525, SQLSTATE=51015, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE SQL STATEMENT CANNOT BE
EXECUTED BECAUSE IT WAS IN
ERROR AT BIND TIME FOR SECTION
= sectno PACKAGE = pkgname
CONSISTENCY TOKEN = contoken
Explanation: One of the following:
v The statement was in error when the package was
bound, but the error was ignored then because the
option SQLERROR (CONTINUE) was used. Since the
statement contains an error, it cannot be executed.
v The statement might not be an executable statement
at this location, or might only be executable by a
DB2 application requester (for example, DECLARE
TABLE in an application running on OS/2 causes
this message).
The variables are:
sectno Section number
pkgname
locid.collid.pkgid
contoken
Consistency token in hexadecimal
System action: The statement cannot be executed.
Programmer response: If the SQL statement is not
supposed to execute at the indicated location, then
correct the program so that the statement in error does
not execute at that location. Precompile, compile, and
bind replace the package. If the SQL statement is
supposed to execute at the indicated location, correct
the problem found when it was bound and bind the
package over using BIND with ACTION(REPLACE). If
multiple versions of the package have been bound,
issue the following SELECT statement to determine
which version has the error: SELECT VERSION FROM
locid.SYSIBM.SYSPACKAGE WHERE LOCATION = ‘ ‘
AND COLLID = ‘collid’ AND NAME = ‘pkgid’ AND
HEX(CONTOKEN) = ‘contoken’
Where:
locid Location name
collid Collection id
pkgid Program name
SQLSTATE: 51015

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