DB2 SQL Errors Codes and Error Messages and Warnings from Error -579 to -581

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-579, SQLSTATE=38004, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
object-type object-name ATTEMPTED TO
READ DATA WHEN THE DEFINITION
OF THE FUNCTION OR PROCEDURE
DID NOT SPECIFY THIS ACTION
Explanation: The current environment does not allow
SQL statements that read data. One of the following
situations had occurred:
v A user-defined function or stored procedure
object-name was invoked and attempted to read data,
but the function or procedure was defined without
the READS SQL DATA or MODIFIES SQL DATA
option.
v A function or procedure defined with CONTAINS
SQL or NO SQL has attempted to invoke another
function or procedure defined with READS SQL
DATA.
In an environment of nested functions and procedures,
the SQL option in effect is the most restrictive one that
has been specified in the nested hierarchy of functions
and procedures. The SQL data access option in effect
does not allow for reading data.
System action: The SQL statement failed.
Programmer response: Either use an ALTER statement
to change the definition of the function or procedure to
allow statements that read data, or remove the failing
SQL statement from the external function or procedure.
SQLSTATE: 38004

Error: DB2 SQL Error: SQLCODE=-580, SQLSTATE=42625, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE RESULT-EXPRESSIONS OF A
CASE EXPRESSION CANNOT ALL BE
NULL
Explanation: There is a CASE expression in the
statement that has all the result-expressions (expressions
following the THEN and ELSE keywords) coded with
the keyword NULL.
System action: The statement cannot be processed.
Programmer response: Change the CASE expression
to include at least one result-expression with a keyword
other than NULL.
SQLSTATE: 42625
Error: DB2 SQL Error: SQLCODE=-581, SQLSTATE=42804, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE DATA TYPES OF THE
RESULT-EXPRESSIONS OF A CASE
EXPRESSION ARE NOT COMPATIBLE
Explanation: There is a CASE expression in the
statement that has result-expressions (expressions
following THEN and ELSE keywords) that are not
compatible. The data type of the result-expressions might
be incompatible because the CASE condition result data
types are not all:
v character
v graphic
v numeric
v date
v time
v timestamp
v binary string
If encoded in Unicode, character and graphic data
types are compatible, however. Refer to DB2 SQL
Reference for more information about Unicode.
System action: The statement cannot be processed.
Programmer response: Correct the result-expressions so
that they are compatible.
SQLSTATE: 42804

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