Ora8StmtPrepare3 Function

Action

Prepares a SQL statement or a PL/SQL block and associates it with a statement handle.

Include file

Ora8.bdh

Syntax

Ora8StmtPrepare3( in  hCtx     : number,
                 out hStmt     : number,
                 in  sql       : sql,
                 in  sKey      : string optional,
                 in  nLanguage : number optional,
                 in  nMode     : number optional ) : boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hCtx Service context handle to be associated with the statement.
hStmt Statement handle.
sql SQL statement or PL/SQL block to prepare.
sKey For statement caching only. The key to the returned statement in the cache. This can be used for future calls to Ora8StmtPrepare3, in which case there is no need to pass in the statement text and related parameters. If the key is passed in, then the statement text and other parameters are ignored and the search is solely based on the key.
nLanguage

Specifies language options (optional).

Possible values are:

  • OCI_V7_SYNTAX: V7 ORACLE parsing syntax
  • OCI_NTV_SYNTAX: Syntax depends upon the version of the server
nMode

Specifies various modes of operation (optional).

The possible values are:

  • OCI_DEFAULT (default)
  • OCI_STMTCACHE_SEARCH_ONLY

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");

    Ora8StmtPrepare3(ghSvcCtx0, ghStmt0, sqlDelete);
    Ora8StmtExecute(ghSvcCtx0, ghStmt0);

    Ora8StmtRelease(ghStmt0);
    
    Ora8Logoff(ghSvcCtx0);
    Ora8HandleFree(ghError0, OCI_HTYPE_ERROR);
    Ora8HandleFree(ghEnv0, OCI_HTYPE_ENV);
  end TMain;
  
dclsql
  sqlDelete:
    DELETE FROM persons;

See also

Oracle Call Interface Programmer's Guide for wrapped Oracle function OCIStmtPrepare2.