SQLSTATE Variable
This variable is char[]-type and contains error and warning codes.
It is retained only for compatibility with SQL-89.
If you want to use it, write a code as follows.
SQLState can be used for checking connection-state.
SQLCODE
This variable contains detailed error-code. user uses SQLCODE without declaring it.
SQLCA
This is variable containing error and warning-code. user uses it without declaring it.
This is structure variable as follows.
- sqlca.sqlcode
Status codes
Description
0
Means that ALTIBASE HDB executed a statement without errors.
> 0
Means that ALTIBASE HDB executed a statement with some errors.
This occurs when SELECT statement without indicator-variable returned a result with NULL.< 0
Means that ALTIBASE HDB didn't execute a statement with some errors.
- sqlca.sqlerrm.sqlerrmc
It contains full-text error-messages. Its length is in sqlca.sqlerrm.sqlerrml
WJ
- sqlca.sqlerrd
It contains number of record processed. (ALTIBASE uses only sqlca.sqlerrd[2])
Pre-Defined Error-Code
SQLCODE |
ALTIBASE HDB |
ORACLE |
Etc |
---|---|---|---|
(SQLCODE = 0) |
SQL_SUCCESS |
SQL_SUCCESS |
|
(SQLCODE = 1) |
SQL_SUCCESS_WITH_INFO |
SQL_SUCCESS_WITH_INFO |
|
(SQLCODE = -1) |
SQL_ERROR |
SQL_ERROR |
|
(SQLCODE = 100) |
SQL_NO_DATA |
SQL_NO_DATA |
|
(SQLCODE = -69720) |
APRE_DUPKEY_ERROR |
ORA-00001 |
|
You can refer to this document
WHENEVER
- Condition
The condition has two states. ALTIBASE HDB doesn't support "SQLWARNING".- SQLERROR
- NOTFOUND
- Action
- CONTINUE
- DO BREAK
- DO CONTINUE
- DO function_name
- GOTO label
- STOP
The connection is to be closed.
Some Notices
- APRE marks "EXEC SQL INCLUDE SQLCA" statement to a comment when precompiling it.
- APRE marks "#include <sqlca.h>" statement to a comment when precompiling it.