Ora8OciError Function

Action

Retrieves the Oracle 8 OCI error code if an OCI error occurred during the last Silk Performer Oracle 8 API function call.

Include file

Ora8.bdh

Syntax

Ora8OciError(): number;

Return value

Oracle 8 OCI error code.

A Silk Performer Oracle API error has occurred if a Silk Performer Oracle API function fails and the Ora8OciError returns 0. In this case, the OraApiError function can be used to retrieve the Silk Performer Oracle 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, sqlSelect, OCI_NTV_SYNTAX);

    // select row from non existing table
    Ora8IgnoreError(ghStmt0, 942);
    Ora8StmtExecute(ghSvcCtx0, ghStmt0);
    write("Oracle OCI error: "); write(Ora8OciError()); writeln;

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

dclsql
  sqlSelect:
    SELECT * FROM non_existing_table;

Output

Oracle OCI error: 942OCI-API Class 0 Error (Warning) 942 in Ora8StmtExecute:
ORA-00942: table or view does not exist