OraApiError Function

Action

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

Include file

Ora.bdh

Syntax

OraApiError(): number;

Return value

Oracle API error code

Example

var
  hConnection : number;
  cCursor : cursor;

dcltrans
  transaction TMain
  begin
    OraLogon(hConnection, "user", "password", "orclnet2");
    OraOpen(cCursor, hConnection);
    OraParse(cCursor, sqlInsert);

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

    // cause API error: index is too large
    OraSetString(cCursor, ":name", "Tom", 5);
    write("Oracle API error: "); write(OraApiError()); writeln;
    write(OraLastErrorText()); writeln;
    
    OraExec(cCursor);
    OraClose(cCursor);
    OraLogoff(hConnection);
  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 OraBind:
ORAAPI: 26 - Index in OraSet/OraGet function is larger than maximum
array size set in OraBind.