Oracle Call Interface Programmer's Guide Release 2 (9.2) Part Number A96584-01 |
|
More OCI Relational Functions, 2 of 106
This call associates an application request with a server.
sword OCIStmtExecute ( OCISvcCtx *svchp, OCIStmt *stmtp, OCIError *errhp, ub4 iters, ub4 rowoff, CONST OCISnapshot *snap_in, OCISnapshot *snap_out, ub4 mode );
Service context handle.
An statement handle. It defines the statement and the associated data to be executed at the server. It is invalid to pass in a statement handle that has bind of data types only supported in release 8.x or later when svchp
points to an Oracle7 server.
An error handle you can pass to OCIErrorGet()
for diagnostic information in the event of an error.
For non-SELECT
statements, the number of times this statement is executed is equal to iters
- rowoff
.
For SELECT
statements, if iters
is nonzero, then defines must have been done for the statement handle. The execution fetches iters
rows into these predefined buffers and prefetches more rows depending upon the prefetch row count. If you do not know how many rows the SELECT
statement will retrieve, set iters
to zero.
This function returns an error if iters
=0 for non-SELECT
statements.
The starting index from which the data in an array bind is relevant for this multiple row execution.
This parameter is optional. if supplied, must point to a snapshot descriptor of type OCI_DTYPE_SNAP. The contents of this descriptor must be obtained from the snap_out
parameter of a previous call. The descriptor is ignored if the SQL is not a SELECT
. This facility allows multiple service contexts to ORACLE to see the same consistent snapshot of the database's committed data. However, uncommitted data in one context is not visible to another context even using the same snapshot.
This parameter optional. if supplied, must point to a descriptor of type OCI_DTYPE_SNAP. This descriptor is filled in with an opaque representation which is the current ORACLE "system change number" suitable as a snap_in
input to a subsequent call to OCIStmtExecute()
. This descriptor should not be used longer than necessary in order to avoid "snapshot too old" errors.
The modes are:
OCIStmtExecute()
in this mode executes the statement. It also implicitly returns describe information about the select-list.OCIStmtExecute()
in this mode does not execute the statement, but it does return the select-list description. To maximize performance, it is recommended that applications execute the statement in default mode and use the implicit describe which accompanies the execution.The modes are not mutually exclusive and can be used together, except for OCI_STMT_SCROLLABLE_READONLY.
This function is used to execute a prepared SQL statement. Using an execute call, the application associates a request with a server.
If a SELECT
statement is executed, the description of the select-list is available implicitly as a response. This description is buffered on the client side for describes, fetches and define type conversions. Hence it is optimal to describe a select list only after an execute.
Also for SELECT
statements, some results are available implicitly. Rows will be received and buffered at the end of the execute. For queries with small row count, a prefetch causes memory to be released in the server if the end of fetch is reached, an optimization that may result in memory usage reduction. Set attribute call has been defined to set the number of rows to be prefetched for each result set.
For SELECT
statements, at the end of the execute, the statement handle implicitly maintains a reference to the service context on which it is executed. It is the user's responsibility to maintain the integrity of the service context. The implicit reference is maintained until the statement handle is freed or the fetch is cancelled or an end of fetch condition is reached.
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|