DB2 SQL Errors Codes and Error Messages and Warnings from Error -029 to -056

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-029, SQLSTATE=42601, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
INTO CLAUSE REQUIRED
Explanation: SELECT statements embedded in an
application program must have an INTO clause to
denote where the results of the SELECT are to be
placed. Dynamic SELECT statements do not permit the
INTO clause.
System action: The statement cannot be executed.
Programmer response: Add the INTO clause to the
SELECT statement and precompile the application
program again.
SQLSTATE: 42601

Error: DB2 SQL Error: SQLCODE=-051, SQLSTATE=3C000, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
identifier-name (sql-type) WAS
PREVIOUSLY DECLARED OR
REFERENCED
Explanation: The identifier name has already been
defined for the indicated type of SQL object.
identifier-name
The name that has already been used.
sql-type The type of SQL object: TABLE, CURSOR, or
STATEMENT.
The definition might have occurred implicitly. For
example, identifier-name might have been found in the
FROM clause of a SELECT, which causes it to be
defined as a table.
A cursor name must be unique within the program or
routine.
System action: The statement cannot be processed.
User response: Remove duplicate definitions or
correct the references.
SQLSTATE: 3C000

Error: DB2 SQL Error: SQLCODE=-056, SQLSTATE=42630, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
AN SQLSTATE OR SQLCODE
VARIABLE DECLARATION IS IN A
NESTED COMPOUND STATEMENT
Explanation: An SQLSTATE or SQLCODE variable
declaration is in a nested compound statement instead
of the outermost compound statement in the SQL
routine.
System action: The statement cannot be processed.
User response: Change the routine definition so that
the SQLSTATE and SQLCODE variables are only
declared in the outermost compound statement of the
SQL routine.
SQLSTATE: 42630

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