Skip to end of metadata
Go to start of metadata

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.

  1. 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.

  2. sqlca.sqlerrm.sqlerrmc
    It contains full-text error-messages. Its length is in sqlca.sqlerrm.sqlerrml

WJ

  1. 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

  1. Condition
    The condition has two states. ALTIBASE HDB doesn't support "SQLWARNING".
    1. SQLERROR
    2. NOTFOUND
  2. Action
    1. CONTINUE
    2. DO BREAK
    3. DO CONTINUE
    4. DO function_name
    5. GOTO label
    6. STOP
      The connection is to be closed.

Some Notices

  1. APRE marks "EXEC SQL INCLUDE SQLCA" statement to a comment when precompiling it.
  2. APRE marks "#include <sqlca.h>" statement to a comment when precompiling it.
  • No labels