SQL/MP to SQL/MX Database and Application Migration Guide

Converting SQL/MP Applications to SQL/MX
Applications
HP NonStop SQL/MP to NonStop SQL/MX Database and Application Migration Guide666211-001
4-49
Error Handling
Error Handling
The major difference in error handling between NonStop SQL/MP and NonStop
SQL/MX relates to the SQL:1999 standard, as described in the following sections:
Format of Error Codes on page 4-49
Equivalent SQLCODE and SQLSTATE Values on page 4-49
WHENEVER Declarative on page 4-52
Diagnostics Area on page 4-52
Format of Error Codes
NonStop SQL/MP provides an integer-valued SQLCODE as the mechanism to send
error information from the database to the application.
NonStop SQL/MX supports both a SQLCODE mechanism and the new SQLSTATE
codes, as specified in the SQL:1999 standard. However, the SQLCODE values
generated by NonStop SQL/MX are different from those generated by NonStop
SQL/MP. For portable applications, use SQLSTATE. Because of the overhead
associated with SQLSTATE, you will most likely use it only for error handling in ANSI-
compliant applications. For information about SQLSTATE and error handling in
NonStop SQL/MX, see the
SQL/MX Programming Guide for C and COBOL.
Equivalent SQLCODE and SQLSTATE Values
Table 4-13. Mapping SQL/MP SQLCODE to SQL/MX SQLCODE
Values (page1of4)
SQL/MP Error Description
SQL/MP
SQLCODE
SQL/MX
SQLCODE
SQL/MX
SQLSTATE
The operation completed successfully. 0 0 00000
No rows were selected or modified. 100 100 02000
The program corrupted the program file
or an invalid code was generated for the
statement, so the statement failed.
-8030 -8840 X08NC
The statement was not prepared before
execution and failed.
-8031 -8822 X08MU
A specified cursor could not be located in
the program where it was declared, so
the statement failed.
-8116 -8836,
-8842
X08N8,
X08NE
An open operation on a table or view
failed because the table or view does not
exist or there was a security violation.
-8200 -8574 X08FY