DB2 SQL Errors Codes and Error Messages and Warnings from Error -397 to -399

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-397, SQLSTATE=428D3, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
GENERATED IS SPECIFIED AS PART
OF A COLUMN DEFINITION, BUT IT
IS NOT VALID FOR THE DEFINITION
OF THE COLUMN
Explanation: GENERATED was specified in a
CREATE or ALTER TABLE statement for a column with
a data type that is not a row ID, a distinct type that is
based on a row ID, a row change timestamp, or an
identity column. GENERATED can only be specified for
a column with a data type of row ID, a distinct type
that is based on a row ID, a row change timestamp, or
an identity column.
System action: The statement cannot be processed.
Programmer response: Correct the statement. Either
eliminate the GENERATED clause or change the
definition of the column to one of the types that can be
generated.
SQLSTATE: 428D3

Error: DB2 SQL Error: SQLCODE=-398, SQLSTATE=428D2, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
A LOCATOR WAS REQUESTED FOR
HOST VARIABLE NUMBER
position-number BUT THE VARIABLE IS
NOT A LOB
Explanation: The application requested that a locator
be returned from host variable number position-number.
A locator can only be used with LOB data, and the
requested data is not a LOB.
System action: The statement cannot be executed.
Programmer response: Change the statement to either
return LOB data, or change the target host variable to
not be a locator.
SQLSTATE: 428D2

Error: DB2 SQL Error: SQLCODE=-399, SQLSTATE=22511, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
INVALID VALUE ROWID WAS
SPECIFIED
Explanation: When inserting into a table, a value
specified for a ROWID column was invalid. Only row
ID values previously generated by DB2 are valid.
System action: The statement cannot be executed.
System programmer response: Do not attempt to
generate any value into a ROWID column. Insertion
into ROWID columns is supported for purposes of
Data Propagation, where DB2 has previously generated
the row ID values. Only row ID values previously
generated by DB2 can be used as values for insertion
into a row ID column. Alternatively, insert the row
specifying DEFAULT for the ROWID column or remove
the ROWID column from the insert column-list.
You could also use the OVERRIDING clause as a
possible solution for this situation. See INSERT in DB2
SQL Reference for more information about the
OVERRIDING USER VALUE clause.
SQLSTATE: 22511

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