#docslug#/obci/obci/V1.2.0/zr8wnz
OCIStmtExecute
Description : You can call this function to execute prepared statements.
Function prototype :
sword OCIStmtExecute (
OCISvcCtx *svchp,
OCIStmt *stmtp,
OCIError *errhp,
ub4 iters,
ub4 rowoff,
CONST OCISnapshot *snap_in,
OCISnapshot *snap_out,
ub4 mode );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | An environment handle. |
| stmtp(IN) | The handle to the statement being processed. |
| errhp(IN/OUT) | An error handle. |
| iters(IN) | For non-SELECT statements, iters and rowoff can be used together. The value of iters-rowoff indicates the number of times a statement is executed. For SELECT statements, iters indicates the number of rows in the buffer read in an execution. If you are uncertain about the number of rows to be returned by the SELECT statement, set iters to 0. If iters is not 0, a handle must have been defined for the statement before execution, which means an address space must have been defined to store variables returned by the SELECT statement. |
| rowoff(IN) | During a multi-row execution, rowoff represents the starting position of the input variable in the array bind. It is a record offset for the purpose of modifying, inserting, or deleting multiple rows. For example, if the bind variable defined is array[100], the value for iters is 80 and the value of rowoff is 20 when the statement is executed, the statement extracts the input value from array[20], and the number of times that the statement is executed is 80 - 20 = 60. |
| snap_in(IN) | Not supported. |
| snap_out(OUT) | Not supported. |
| mode(IN) | The mode of execution. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
Note : The following table describes the modes supported by OBCI.
| Mode | Description |
|---|---|
| OCI_COMMIT_ON_SUCCESS | Commits the transaction after a success execution. |
| OCI_DEFAULT | The default mode. |
| OCI_DESCRIBE_ONLY | Describe information. |
| OCI_EXACT_FETCH | Fetch row data. |
| OCI_PARSE_ONLY | Parse the statement. |
OCIStmtFetch
Description : You can call this function to fetch rows from the result set returned by an SQL statement. After you execute an SQL statement, you can call this function multiple times to return all rows of the result set until the function returns OCI_NO_DATA.
Function prototype :
sword OCIStmtFetch (
OCIStmt *stmtp,
OCIError *errhp,
ub4 nrows,
ub2 orientation,
ub4 mode)
Parameters :
| Parameter | Description |
|---|---|
| stmtp(IN) | The handle to the statement being processed. |
| errhp(IN/OUT) | An error handle. |
| nrows(IN) | The number of rows to be fetched. |
| orientation (IN) | The method to fetch the rows. |
| mode(IN) | The mode of the operation. OBCI V1.2.0 only supports OCI_DEFAULT, which is the default mode. |
Return value : OCI_SUCCESS if succeeded, OCI_ERROR if failed, OCI_SUCCESS_WITH_INFO if alerted, or OCI_NO_DATA if no data is fetched after the end of the row set is reached.
Note : The following table describes the method supported by OBCI to fetch rows.
| Method | Description |
|---|---|
| OCI_FETCH_NEXT | Fetches the next row downward from the current cursor position. |
OCIStmtFetch2
Description : You can call this function to fetch a row from a scrollable result set.
Function prototype :
sword OCIStmtFetch2 (OCIStmt *stmthp,OCIError *errhp,ub4 nrows,ub2 orientation,sb4 fetchOffset,ub4 mode );
Parameters :
| Parameter | Description |
|---|---|
| stmthp (INOUT) | The handle to the statement being processed. |
| errhp (INOUT) | An error handle. |
| nrows(IN) | The number of rows to be fetched. |
| orientation(IN) | The orientation of the cursor. |
| fetchOffset(IN) | The offset. |
| mode(IN) | The mode of the operation. This parameter is not supported. Ignore it. |
Return value : OCI_SUCCESS if succeeded, OCI_ERROR if failed, OCI_SUCCESS_WITH_INFO if alerted, or OCI_NO_DATA if failed to fetch data beyond the end of the row set.
Note : The following table describes the cursor orientations supported by OBCI.
| Directionality | Description |
|---|---|
| OCI_FETCH_NEXT/OCI_DEFAULT | Fetches the next row from the current position. |
| OCI_FETCH_CURRENT | Fetches the current row. |
| OCI_FETCH_FIRST | Fetches the first row in the result set. |
| OCI_FETCH_LAST | Fetches the last row in the result set. |
| OCI_FETCH_PRIOR | Fetches the previous row of the current row in the result set. |
| OCI_FETCH_ABSOLUTE | Fetches a row by its absolute position in the result set. |
| OCI_FETCH_RELATIVE | Fetches a row by its relative position in the result set. |
OCIStmtPrepare
Description : You can call this function to prepare an SQL statement that you can execute by calling the OCIStmtExecute() function.
Function prototype :
sword OCIStmtPrepare (
OCIStmt *stmtp,
OCIError *errhp,
CONST text *stmt,
ub4 stmt_len,
ub4 language,
ub4 mode );
Parameters :
| Parameter | Description |
|---|---|
| stmtp(IN) | The handle to the statement being processed. |
| errhp(IN/OUT) | An error handle. |
| stmt(IN) | The SQL statement to be executed. |
| stmt_len(IN) | The length of the SQL statement specified in the stmt parameter. |
| language(IN) | A reserved parameter. |
| mode(IN) | The mode of preparation. OBCI V1.2.0 only supports OCI_DEFAULT, which is the default mode. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
OCIStmtPrepare2
Description : You can call this function to prepare an SQL statement that you can execute by calling the OCIStmtExecute() function. Ensure that statement cache is enabled.
Function prototype :
sword OCIStmtPrepare2 (
OCISvcCtx *svchp,
OCIStmt **stmthp,
OCIError *errhp,
const OraText *stmttext,
ub4 stmt_len,
const OraText *key,
ub4 keylen,
ub4 language,
ub4 mode );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | An environment handle. |
| stmthp(OUT) | The handle to the statement being processed. |
| errhp(IN) | An error handle. |
| stmttext(IN) | The statement text. It has the same semantics as those of the OCIStmtPrepare() function. Therefore, the string must end with NULL. |
| stmt_len(IN) | The length of the SQL statement specified in the stmt parameter. |
| key(IN) | For statement caching only. It is the key used for searching the statement in the statement cache. If the key is passed in, the statement text and other parameters are ignored and the search is solely based on the key. |
| keylen(IN) | Valid only for statement caching. It indicates the length of the key. |
| language(IN) | A reserved parameter. |
| mode(IN) | The mode of preparation. OBCI V1.2.0 only supports OCI_DEFAULT, which is the default mode. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
OCIStmtRelease
Description : You can call this function to release statement handles that you fetched by calling the OCIStmtPrepare2() function.
Function prototype:
sword OCIStmtRelease (
OCIStmt *stmthp,
OCIError *errhp,
const OraText *key,
ub4 keylen,
ub4 mode );
Parameters:
| Parameter | Description |
|---|---|
| stmtp(IN/OUT) | The handle to the SQL statement being processed. |
| errhp(IN/OUT) | An error handle. |
| key(IN) | Valid only for statement caching. This is the SQL string passed in by the caller. If a NULL key is passed in the statement, it will not be tagged. |
| keylen(IN) | Valid only for statement caching. It indicates the length of the key. |
| mode(IN) | The mode of preparation. OBCI V1.2.0 only supports OCI_DEFAULT, which is the default mode. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.