Ora8ApiError Function

Action

Retrieves the Silk Performer Oracle 8 API error code if an API error occurred during the last Silk Performer Oracle 8 API function call. A Silk Performer Oracle 8 API error occurs because of incorrect use of the Silk Performer Oracle 8 API and stops the simulation by default.

Include file

Ora8.bdh

Syntax

Ora8ApiError(): number;

Return value

Oracle 8 API error code

Example

var
  ghEnv0        : number;
  ghError0      : number;
  ghStmt0       : number;
  ghSvcCtx0     : number;

dcltrans
  transaction TMain
  begin
    Ora8Init(ghEnv0, OCI_DEFAULT);
    Ora8HandleAlloc(ghEnv0, ghError0, OCI_HTYPE_ERROR);
    Ora8Logon(ghEnv0, ghSvcCtx0, "user", "password", "orclnet2");
    Ora8HandleAlloc(ghEnv0, ghStmt0, OCI_HTYPE_STMT);
    Ora8StmtPrepare(ghStmt0, sqlInsert, OCI_NTV_SYNTAX);

    // array binding: three elements
    Ora8Bind(ghStmt0, ":name", SQLT_CHR, 32, 3);
    Ora8Bind(ghStmt0, ":age", SQLT_INT, 0, 3);

    // cause API error: index is too large
    Ora8SetString(ghStmt0, ":name", "Tom", 5);
    write("Oracle API error: "); write(Ora8ApiError()); writeln;

    Ora8StmtExecute(ghSvcCtx0, ghStmt0);

    Ora8HandleFree(ghStmt0, OCI_HTYPE_STMT);
    Ora8Logoff(ghSvcCtx0);
    Ora8HandleFree(ghError0, OCI_HTYPE_ERROR);
    Ora8HandleFree(ghEnv1, OCI_HTYPE_ENV);
  end TMain;

dclsql
  sqlInsert:
    INSERT INTO persons (name, age) VALUES (:name, :age);

Output

Oracle API error: 26
ORA-API Class 0 Error (Warning) 26 in Ora8Bind:
ORAAPI: 26 - Index in Ora8Set/Ora8Get function is larger than maximum
array size set in Ora8Bind.