Ora8DefineLob Function

Action

Defines the specified LOB descriptor as output variable for the specified select-list item in the SQL query.

Include file

Ora8.bdh

Syntax

Ora8DefineLob( in  hStmt       : number,
               in  nPosition   : number,
               in  nDatatype   : number,
               in  nSize       : number,
               in  hDescriptor : number ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hStmt Statement handle.
nPosition Index of the select-list item in the SQL query. Position indices start at 1 for the first (leftmost) select-list item.
nDatatype Oracle external data type of the select-list item. See Oracle 8 data types for a list of Oracle data types.
nSize Length of the select-list item in bytes.
hDescriptor Variable used as output buffer for the specified select-list item.

Example

var
  ghEnv0        : number;
  ghError0      : number;
  ghStmt0       : number;
  ghSvcCtx0     : number;
  ghDescriptor0 : 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);
    Ora8DescriptorAlloc(ghEnv0, ghDescriptor0, OCI_DTYPE_LOB);
    Ora8DefineLob(ghStmt0, 1, SQLT_BLOB, 0, ghDescriptor0);
    Ora8StmtExecute(ghSvcCtx0, ghStmt0, 0, 1); // rows fetched: 1

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

dclsql
  sqlSelect:
    SELECT PRODUCT_IMAGE FROM PRODUCT_INFORMATION WHERE ROWID = 'AAAeUrAASAAABFUAAQ';

See also

Oracle's Programmer's Guide to Oracle Call Interface for Wrapped Oracle functions: OCIDefineByPos