IBM Books

XML Extender Administration and Programming


Handling UDF return codes

Embedded SQL statements return codes in the SQLCODE, SQLWARN, and SQLSTATE fields of the SQLCA structure. This structure is defined in an SQLCA INCLUDE file. (For more information about the SQLCA structure and SQLCA INCLUDE file, see the DB2 Application Development Guide.)

DB2 CLI calls return SQLCODE and SQLSTATE values that you can retrieve using the SQLError function. (For more information about retrieving error information with the SQLError function, see the CLI Guide and Reference.)

An SQLCODE value of 0 means that the statement ran successfully (with possible warning conditions). A positive SQLCODE value means that the statement ran successfully but with a warning. (Embedded SQL statements return information about the warning that is associated with 0 or positive SQLCODE values in the SQLWARN field.) A negative SQLCODE value means that an error occurred.

DB2 associates a message with each SQLCODE value. If an XML Extender UDF encounters a warning or error condition, it passes associated information to DB2 for inclusion in the SQLCODE message.

SQLSTATE values contain codes that supplement the SQLCODE messages. See SQLSTATE codes for a description of each SQLSTATE code that the XML Extender returns.

Embedded SQL statements and DB2 CLI calls that invoke the DB2 XML Extender UDFs might return SQLCODE messages and SQLSTATE values that are unique to these UDFs, but DB2 returns these values in the same way as it does for other embedded SQL statements or other DB2 CLI calls. Thus, the way you access these values is the same as for embedded SQL statements or DB2 CLI calls that do not start the DB2 XML Extender UDFs.

See SQLSTATE codes for the SQLSTATE values and the message number of associated messages that can be returned by the XML Extender. See Messages for information about each message.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]