Ora8StmtPrepare2 Function

Action

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

Include file

Ora8.bdh

Syntax

Ora8StmtPrepare2( in  hStmt      : number,
                  in  sStatement : string,
                  in  nLanguage  : number optional,
                  in  nMode      : number optional ): boolean;

Return value

  • true if successful

  • false otherwise.

Parameter Description
hStmt Statement handle.
sStatement SQL statement or PL/SQL to prepare.
nLanguage

Specifies language options (optional).

Possible values are:

  • OCI_NTV_SYNTAX

  • OCI_V7_SYNTAX

  • OCI_V8_SYNTAX

nMode

Specifies various modes of operation (optional).

The possible values are:

  • OCI_DEFAULT (default)

  • OCI_NO_SHARING

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

    Ora8HandleAlloc(ghEnv0, ghStmt0, OCI_HTYPE_STMT);
    Ora8StmtPrepare2(ghStmt0, "DELETE from persons", OCI_NTV_SYNTAX);
    Ora8StmtExecute(ghSvcCtx0, ghStmt0);

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

See also

Oracle's Programmer's Guide to Oracle Call Interface for Wrapped Oracle function: OCIStmtPrepare