Progress
Embedded SQL-92
Guide and Reference
Using an SQLCA to Check for Errors
Sometimes an attempted SQL operation does not succeed. You can check the SQLCA for the error code and the corresponding error message. Use the following components of the SQLCA structure to obtain the error codes and error messages:
The SQLCODE component indicates the return status after the execution of an SQL statement. SQLCODE is set to zero for a successful execution and is negative for a failure. Also, SQLCODE can report SQL_NOT_FOUND, which is set during a FETCH operation when there are no more rows to be fetched.
The component SQLERRM is a null-terminated character string, which is the diagnostic text corresponding to the SQLCODE.
The component SQLERRML contains the length of the error message in SQLERRM.
The component SQLERRD is an array of six INTEGER variables.
EXAMPLEThe following code fragment shows how to use the SQLCA components SQLCODE and SQLERRM:
EXAMPLE
The following example shows how to check for the SQL_NOT_FOUND status code after a FETCH operation:
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |