Ora8LobOpen Function

Action

Opens a LOB, internal or external, in the specified mode.

Include file

Ora8.bdh

Syntax

Ora8LobOpen( in hSvcCtx : number,
             in hLobLoc : number,
             in nMode   : number ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hSvcCtx The service context handle.
hLobLoc An internal LOB locator that references the LOB.
nMode

The mode in which to open the LOB.

Valid modes are:

  • OCI_LOB_READONLY

  • OCI_LOB_READWRITE

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, TMain_SQL001, OCI_NTV_SYNTAX);
    Ora8DescriptorAlloc(ghEnv0, ghDescriptor0, OCI_DTYPE_LOB);
    Ora8LobCreateTemporary(ghSvcCtx0, ghDescriptor0, OCI_TEMP_BLOB, OCI_DURATION_SESSION, true);
    Ora8LobOpen(ghSvcCtx0, ghDescriptor0, OCI_LOB_READWRITE);
    Ora8LobWrite(ghSvcCtx0, ghDescriptor0, 9894, 9894, 1);

    Ora8Bind(ghStmt0, "1", SQLT_CHR, 5, 1, ORA_PLSQL_IN);                    //p_productid, in, number
    Ora8BindLob(ghStmt0, "2", SQLT_BLOB, 4, 1, ORA_PLSQL_IN, ghDescriptor0); //p_productimage, in, blob

    Ora8SetString(ghStmt0, "1", "2254"); //p_productid

    Ora8StmtExecute(ghSvcCtx0, ghStmt0, 1, 0, 0, 0, OCI_COMMIT_ON_SUCCESS);
    Ora8HandleFree(ghStmt0, OCI_HTYPE_STMT);
    Ora8Logoff(ghSvcCtx0);
    Ora8HandleFree(ghError0, OCI_HTYPE_ERROR);
    Ora8HandleFree(ghEnv0, OCI_HTYPE_ENV);
  end TMain;

dclsql
  TMain_SQL001:
    [BEGIN setproductimage(:1,:2); END;]

See also

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