|Oracle Call Interface Programmer's Guide
Part Number A89857-01
OCI Relational Functions, 38 of 39
This call prepares a SQL or PL/SQL statement for execution.
sword OCIStmtPrepare ( OCIStmt *stmtp, OCIError *errhp, CONST text *stmt, ub4 stmt_len, ub4 language, ub4 mode );
A statement handle associated with the statement to be executed. By default, it contains the encoding setting in the environment handle from which it is derived. A statement can be prepared in UTF-16 encoding only in a UTF-16 environment.
An error handle you can pass to
OCIErrorGet() for diagnostic information in the event of an error.
SQL or PL/SQL statement to be executed. Must be a null-terminated string. That is, the ending character is a number of NULL bytes, depending on the encoding. The statement should be in UTF-16 if the environment handle is created with OCI_UTF16 mode.
Always cast the parameter to (text *
). After a statement has been prepared in UTF-16, the character set for the bind and define buffers will default to UTF-16. The pointer to the text of the statement must be available as long as the statement is executed, or data is fetched from it.
Length of the statement in characters or in number of bytes, depending on the encoding. Must not be zero.
Specifies V7, or native syntax. Possible values are:
Similar to the
mode in the
OCIEnvCreate() call, but this one has higher priority because it can override the "naturally" inherited mode setting.
The possible values are:
stmtpuses whatever is specified by its parent environment handle.
An OCI application uses this call to prepare a SQL or PL/SQL statement for execution. The
OCIStmtPrepare() call defines an application request.
mode parameter determines whether the statement content is encoded as UTF-16 or not. The statement length is in number of codepoints or in number of bytes, depending on the encoding.
While the statement handle inherits the encoding setting from the parent environment handle, the
mode for this call can also change the encoding setting for the statement handle itself.
Data values for this statement initialized in subsequent bind calls will be stored in a bind handle which use settings in this statement handle as default.
This call does not create an association between this statement handle and any particular server.
See the section "Preparing Statements" for more information about using this call.