Ora8GetValue Function


Retrieves any value either from the program variable that is bound with the specified place holder in the SQL statement or PL/SQL block, or from the output variable that is defined for the specified select-list item in the SQL query. This function is used to retrieve values from both scalar and array program variables that are defined for the specified select-list item.

Include file



Ora8GetValue( in  hStmt       : number,
              in  sSqlVar     : string,
              out sValue      : string,
              in  nBufferSize : number,
              in  nIndex      : number optional,
              in  nDatatype   : number optional ): boolean;

Return value

  • true if successful

  • false otherwise; In this case, you can use the Ora8OciError function to retrieve the Oracle OCI error code.

Parameter Description
hStmt Statement handle.

This parameter can be one of the following:

  • The name of the place holder in the SQL statement or PL/SQL block. In this case, the parameter must include the preceding colon identifying it as a place holder.

  • The index of the select-list item in the SQL query. Position indices start at 1 for the first (leftmost) select-list item.

Note: In the latter case, the column number has to be passed to the function as a string.

sValue Variable receiving either the value assigned to the place holder or the data retrieved from a fetched row, as the case may be
nBufferSize Size of the variable receiving the value

Index or row number (optional). This parameter has to be passed to the function whenever retrieving a value assigned to an array place holder or fetching data from multiple rows. It can be one of the following:

  • The array index of the program variable.

  • The row number for the long value in the fetched data.

nDatatype Specifies which data type to retrieve (optional). See Oracle 8 data types for a list of data types.


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

  transaction TMain
    nAge : number;
    sName : string;
    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);

    Ora8Bind(ghStmt0, ":1", SQLT_INT);
    Ora8SetInt(ghStmt0, ":1", 25);
    Ora8Define(ghStmt0, 1, SQLT_CHR, 32);
    Ora8Define(ghStmt0, 2, SQLT_INT);
    Ora8StmtExecute(ghSvcCtx0, ghStmt0);

    while Ora8StmtFetch(ghStmt0, 1, 1) do
      Ora8GetValue(ghStmt0, "1", sName, STRING_COMPLETE);
      nAge  := Ora8GetInt(ghStmt0, "2");
      write(sName, 32); write(nAge, 5); writeln;

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

    SELECT * FROM persons WHERE age > :1;


Howard 33Michael 44Bobby 61Sara 38