OCILIB (C and C++ Driver for Oracle)  4.9.0
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Loading...
Searching...
No Matches
Fetching data

Detailed Description

OcilibCApiBinding

OCILIB provides a simple and efficient mechanism to fetch data from SQL statements, similar to what is found in JDBC and other object-oriented database frameworks.

Only the following statements can return result sets that can be fetched by host programs:

These result sets are encapsulated in OCILIB by OCI_Resultset objects.

After any successful call to an OCI_ExecuteXXX() function that executed a fetchable statement or filled output bind variables, the result set can be retrieved by calling OCI_GetResultset().

The creation of an OCI_Resultset object consists of:

OCILIB supports multi-row fetching for improved performance. Instead of fetching data row by row from the server (which induces many round-trips between the client and the server), the library prefetches data in chunks (default is 20 rows), resulting in less network traffic and better performance. This mechanism is completely transparent to the application, which fetches the result set row by row.

Once the result set handle is retrieved:

Note
For statements that execute PL/SQL calls or blocks returning implicit result sets:
Scrollable Result Sets

Oracle 9i introduced scrollable cursors (result sets in OCILIB) that can be fetched:

Scrollable statements use more server and client resources and should only be used when necessary.

Result sets are 'forward only' by default. Call OCI_SetFetchMode() with OCI_SFM_SCROLLABLE to enable scrollable result sets for a given statement.

Warning
Any use of scrollable fetching functions with a result set that depends on a statement with fetch mode set to OCI_SFM_DEFAULT will fail.
If you intend to use OCI_FetchSeek() on a scrollable statement and if any of the selected columns is a REF CURSOR or a nested table, OCILIB will internally set the result set internal array size to 1 and thus ignore any values set using OCI_SetFetchSize(). This is performed due to an Oracle bug.
Note
If the column's internal data does not match the requested type, OCILIB tries to convert the data when possible and throws an error if not.

The properties (column names, types, etc.) of the result set are accessible through a set of APIs.

Implicit Conversion to String Types

OCI_GetString() performs an implicit conversion from any Oracle type:

Note
For RAWs and BLOBs, their binary values are converted to hexadecimal strings. For LONGs and CLOBs/NCLOBs, the entire string content is returned.
The following OCILIB types are not supported for implicit conversion:
  • OCI_Statement
Warning
For date and numeric types, OCILIB uses OCI client calls to perform the conversion. For binary double and binary float data types, OCI client functions cannot handle the full double range of values. Therefore, OCILIB uses the standard C library to convert these data types to strings.
Fetching Rows into User Structures

It is possible to fetch a complete row into a user-defined structure. Each column of the result set is mapped to a structure member. The mapping rules are:

See OCI_GetStruct() and OCI_SetStructNumericType() for more details.

Fetch example
#include "ocilib.h"
/* requires script demo/products.sql */
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
OCI_ExecuteStmt(st, "select * from products");
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
printf("code: %i, name %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
}
printf("\n%d row(s) fetched\n", OCI_GetRowCount(rs));
return EXIT_SUCCESS;
}
OCI_SYM_PUBLIC boolean OCI_API OCI_ConnectionFree(OCI_Connection *con)
Close a physical connection to an Oracle database server.
OCI_SYM_PUBLIC OCI_Connection *OCI_API OCI_ConnectionCreate(const otext *db, const otext *user, const otext *pwd, unsigned int mode)
Create a physical connection to an Oracle database server.
struct OCI_Connection OCI_Connection
Oracle physical connection.
Definition: types.h:124
struct OCI_Statement OCI_Statement
Oracle SQL or PL/SQL statement.
Definition: types.h:136
struct OCI_Error OCI_Error
Encapsulates an Oracle or OCILIB exception.
Definition: types.h:410
struct OCI_Resultset OCI_Resultset
Collection of output columns from a select statement.
Definition: types.h:163
OCI_SYM_PUBLIC const otext *OCI_API OCI_ErrorGetString(OCI_Error *err)
Retrieve the error message string from an error handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchNext(OCI_Resultset *rs)
Fetch the next row of the result set.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRowCount(OCI_Resultset *rs)
Retrieve the number of rows fetched so far.
OCI_SYM_PUBLIC const otext *OCI_API OCI_GetString(OCI_Resultset *rs, unsigned int index)
Return the current string value of the column at the given index in the result set.
OCI_SYM_PUBLIC OCI_Resultset *OCI_API OCI_GetResultset(OCI_Statement *stmt)
Retrieve the result set handle from an executed statement.
OCI_SYM_PUBLIC int OCI_API OCI_GetInt(OCI_Resultset *rs, unsigned int index)
Return the current integer value of the column at the given index in the result set.
OCI_SYM_PUBLIC boolean OCI_API OCI_Cleanup(void)
Clean up all resources allocated by the library.
OCI_SYM_PUBLIC boolean OCI_API OCI_Initialize(POCI_ERROR err_handler, const otext *lib_path, unsigned int mode)
Initialize the library.
OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_StatementCreate(OCI_Connection *con)
Create a statement object and return its handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_ExecuteStmt(OCI_Statement *stmt, const otext *sql)
Prepare and execute a SQL statement or PL/SQL block in a single call.
OCI_SYM_PUBLIC boolean OCI_API OCI_StatementFree(OCI_Statement *stmt)
Free a statement and all resources associated with it (result sets, bind variables,...
Fetch rows into user structures example
#include "ocilib.h"
/* requires script demo/products.sql */
typedef struct product_t
{
int code;
char *name;
} product_t;
typedef struct product_ind_t
{
boolean code;
boolean name;
} product_ind_t;
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
product_t prd;
product_ind_t ind;
int i = 0;
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
OCI_ExecuteStmt(st, "select * from products");
rs = OCI_GetResultset(st);
OCI_SetStructNumericType(rs, 1, OCI_NUM_INT);
while (OCI_FetchNext(rs))
{
OCI_GetStruct(rs, &prd, &ind);
printf("row #%d \n"
" \n"
"...prd.code : %d \n"
"...prd.name : %s \n"
" \n",
++i, prd.code, prd.name);
}
printf("\n\n%d row(s) fetched\n", OCI_GetRowCount(rs));
return EXIT_SUCCESS;
}
OCI_SYM_PUBLIC boolean OCI_API OCI_SetStructNumericType(OCI_Resultset *rs, unsigned int index, unsigned int type)
Set the numeric data type of the given structure member (identified by position in the result set) to...
OCI_SYM_PUBLIC boolean OCI_API OCI_GetStruct(OCI_Resultset *rs, void *row_struct, void *row_struct_ind)
Return the row column values into a single structure.
Meta data example
#include "ocilib.h"
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
int i, n;
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
OCI_ExecuteStmt(st, "select * from user_tables");
rs = OCI_GetResultset(st);
for (i = 1; i <= n; i++)
{
OCI_Column *col = OCI_GetColumn(rs, i);
printf("Field #%i : name '%s' - size %i\n", i, OCI_ColumnGetName(col), OCI_ColumnGetSize(col));
}
return EXIT_SUCCESS;
}
struct OCI_Column OCI_Column
Oracle SQL Column and Type member representation.
Definition: types.h:175
OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_GetColumn(OCI_Resultset *rs, unsigned int index)
Return the column object handle at the given index in the result set.
OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetName(OCI_Column *col)
Return the name of the given column.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetColumnCount(OCI_Resultset *rs)
Return the number of columns in the result set.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSize(OCI_Column *col)
Return the size of the column.
Ref cursor example
#include "ocilib.h"
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
OCI_ExecuteStmt(st, "select rownum, cursor(select sysdate from dual) from (select 1 from dual connect by level <= 10)");
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
while (OCI_FetchNext(rs2))
{
printf("index: %d, date: %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs2, 1));
}
}
return EXIT_SUCCESS;
}
OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_GetStatement(OCI_Resultset *rs, unsigned int index)
Return the current cursor value (Nested table) of the column at the given index in the result set.
Implicit result set example
#include "ocilib.h"
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
int nb_rs = 0;
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
"declare"
" c1 sys_refcursor;"
" c2 sys_refcursor;"
" begin"
" open c1 for select * from tabs;"
" dbms_sql.return_result (c1); "
" open c2 for select * from cols;"
" dbms_sql.return_result (c2); "
"end;");
rs = OCI_GetResultset(st);
while (rs)
{
printf("Iterating on resultset #%d\n", ++nb_rs);
while (OCI_FetchNext(rs))
{
printf("...%s\n", OCI_GetString(rs, 1));
}
}
printf("\nFound %d resultsets\n", nb_rs);
return EXIT_SUCCESS;
}
OCI_SYM_PUBLIC OCI_Resultset *OCI_API OCI_GetNextResultset(OCI_Statement *stmt)
Retrieve the next available resultset.
Scrollable result set example
#include "ocilib.h"
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
OCI_SetFetchMode(st, OCI_SFM_SCROLLABLE);
OCI_ExecuteStmt(st, "select rownum, 'Row ' || rownum from (select 1 from dual connect by level <= 65)");
rs = OCI_GetResultset(st);
/* get resultset row count */
printf("resultset contains %i rows\n", OCI_GetRowCount(rs));
/* go to row 1 */
printf("%i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
/* enumerate from row 2 to row X */
while (OCI_FetchNext(rs))
{
printf("%i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
}
/* enumerate from row X back to row 1 */
while (OCI_FetchPrev(rs))
{
printf("%i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
}
/* print the 30th row */
OCI_FetchSeek(rs, OCI_SFD_ABSOLUTE, 30);
printf("%i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
/* fetch next 30 rows */
while ((OCI_GetCurrentRow(rs) < 60) && OCI_FetchNext(rs))
{
printf("%0i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
}
/* move back to the 45th row */
OCI_FetchSeek(rs, OCI_SFD_RELATIVE, -15);
printf("%i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
return EXIT_SUCCESS;
}
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchSeek(OCI_Resultset *rs, unsigned int mode, int offset)
Fetch the result set at a specific position.
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchPrev(OCI_Resultset *rs)
Fetch the previous row of the result set.
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchLast(OCI_Resultset *rs)
Fetch the last row of the result set.
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchFirst(OCI_Resultset *rs)
Fetch the first row of the result set.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetCurrentRow(OCI_Resultset *rs)
Retrieve the current row number.
OCI_SYM_PUBLIC boolean OCI_API OCI_SetFetchMode(OCI_Statement *stmt, unsigned int mode)
Set the fetch mode of a SQL statement.

Functions

OCI_SYM_PUBLIC OCI_Resultset *OCI_API OCI_GetResultset (OCI_Statement *stmt)
 Retrieve the result set handle from an executed statement.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_ReleaseResultsets (OCI_Statement *stmt)
 Free the statement result sets.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchNext (OCI_Resultset *rs)
 Fetch the next row of the result set.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchPrev (OCI_Resultset *rs)
 Fetch the previous row of the result set.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchFirst (OCI_Resultset *rs)
 Fetch the first row of the result set.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchLast (OCI_Resultset *rs)
 Fetch the last row of the result set.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchSeek (OCI_Resultset *rs, unsigned int mode, int offset)
 Fetch the result set at a specific position.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRowCount (OCI_Resultset *rs)
 Retrieve the number of rows fetched so far.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetCurrentRow (OCI_Resultset *rs)
 Retrieve the current row number.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetColumnCount (OCI_Resultset *rs)
 Return the number of columns in the result set.
 
OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_GetColumn (OCI_Resultset *rs, unsigned int index)
 Return the column object handle at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_GetColumn2 (OCI_Resultset *rs, const otext *name)
 Return the column object handle from its name in the result set.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetColumnIndex (OCI_Resultset *rs, const otext *name)
 Return the index of a column in the result set from its name.
 
OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetName (OCI_Column *col)
 Return the name of the given column.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetType (OCI_Column *col)
 Return the type of the given column.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetCharsetForm (OCI_Column *col)
 Return the charset form of the given column.
 
OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetSQLType (OCI_Column *col)
 Return the Oracle SQL type name of the column data type.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetFullSQLType (OCI_Column *col, otext *buffer, unsigned int len)
 Return the Oracle SQL Full name including precision and size of the column data type.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSize (OCI_Column *col)
 Return the size of the column.
 
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetScale (OCI_Column *col)
 Return the scale of the column for numeric columns.
 
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetPrecision (OCI_Column *col)
 Return the precision of the column for numeric columns.
 
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetFractionalPrecision (OCI_Column *col)
 Return the fractional precision of the column for timestamp and interval columns.
 
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetLeadingPrecision (OCI_Column *col)
 Return the leading precision of the column for interval columns.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_ColumnGetNullable (OCI_Column *col)
 Return the nullable attribute of the column.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_ColumnGetCharUsed (OCI_Column *col)
 Return TRUE if the length of the column is character-length, or FALSE if it is byte-length.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetPropertyFlags (OCI_Column *col)
 Return the column property flags.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetCollationID (OCI_Column *col)
 Return the column collation ID.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetDimension (OCI_Column *col)
 Return the column dimension (for VECTOR type)
 
OCI_SYM_PUBLIC OCI_TypeInfo *OCI_API OCI_ColumnGetTypeInfo (OCI_Column *col)
 Return the type information object associated with the column.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSubType (OCI_Column *col)
 Return the OCILIB object subtype of a column.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetStructNumericType (OCI_Resultset *rs, unsigned int index, unsigned int type)
 Set the numeric data type of the given structure member (identified by position in the result set) to retrieve when calling OCI_GetStruct()
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetStructNumericType2 (OCI_Resultset *rs, const otext *name, unsigned int type)
 Set the numeric data type of the given structure member (identified by column name in the result set) to retrieve when calling OCI_GetStruct()
 
OCI_SYM_PUBLIC boolean OCI_API OCI_GetStruct (OCI_Resultset *rs, void *row_struct, void *row_struct_ind)
 Return the row column values into a single structure.
 
OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_GetNumber (OCI_Resultset *rs, unsigned int index)
 Return the current Number value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_GetNumber2 (OCI_Resultset *rs, const otext *name)
 Return the current number value of the column from its name in the result set.
 
OCI_SYM_PUBLIC short OCI_API OCI_GetShort (OCI_Resultset *rs, unsigned int index)
 Return the current short value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC short OCI_API OCI_GetShort2 (OCI_Resultset *rs, const otext *name)
 Return the current short value of the column from its name in the result set.
 
OCI_SYM_PUBLIC unsigned short OCI_API OCI_GetUnsignedShort (OCI_Resultset *rs, unsigned int index)
 Return the current unsigned short value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC unsigned short OCI_API OCI_GetUnsignedShort2 (OCI_Resultset *rs, const otext *name)
 Return the current unsigned short value of the column from its name in the result set.
 
OCI_SYM_PUBLIC int OCI_API OCI_GetInt (OCI_Resultset *rs, unsigned int index)
 Return the current integer value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC int OCI_API OCI_GetInt2 (OCI_Resultset *rs, const otext *name)
 Return the current integer value of the column from its name in the result set.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetUnsignedInt (OCI_Resultset *rs, unsigned int index)
 Return the current unsigned integer value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetUnsignedInt2 (OCI_Resultset *rs, const otext *name)
 Return the current unsigned integer value of the column from its name in the result set.
 
OCI_SYM_PUBLIC big_int OCI_API OCI_GetBigInt (OCI_Resultset *rs, unsigned int index)
 Return the current big integer value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC big_int OCI_API OCI_GetBigInt2 (OCI_Resultset *rs, const otext *name)
 Return the current big integer value of the column from its name in the result set.
 
OCI_SYM_PUBLIC big_uint OCI_API OCI_GetUnsignedBigInt (OCI_Resultset *rs, unsigned int index)
 Return the current unsigned big integer value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC big_uint OCI_API OCI_GetUnsignedBigInt2 (OCI_Resultset *rs, const otext *name)
 Return the current unsigned big integer value of the column from its name in the result set.
 
OCI_SYM_PUBLIC const otext *OCI_API OCI_GetString (OCI_Resultset *rs, unsigned int index)
 Return the current string value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC const otext *OCI_API OCI_GetString2 (OCI_Resultset *rs, const otext *name)
 Return the current string value of the column from its name in the result set.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRaw (OCI_Resultset *rs, unsigned int index, void *buffer, unsigned int len)
 Copy the current raw value of the column at the given index into the specified buffer.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRaw2 (OCI_Resultset *rs, const otext *name, void *buffer, unsigned int len)
 Copy the current raw value of the column from its name into the specified buffer.
 
OCI_SYM_PUBLIC double OCI_API OCI_GetDouble (OCI_Resultset *rs, unsigned int index)
 Return the current double value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC double OCI_API OCI_GetDouble2 (OCI_Resultset *rs, const otext *name)
 Return the current double value of the column from its name in the result set.
 
OCI_SYM_PUBLIC float OCI_API OCI_GetFloat (OCI_Resultset *rs, unsigned int index)
 Return the current float value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC float OCI_API OCI_GetFloat2 (OCI_Resultset *rs, const otext *name)
 Return the current float value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_GetDate (OCI_Resultset *rs, unsigned int index)
 Return the current date value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_GetDate2 (OCI_Resultset *rs, const otext *name)
 Return the current date value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_GetTimestamp (OCI_Resultset *rs, unsigned int index)
 Return the current timestamp value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_GetTimestamp2 (OCI_Resultset *rs, const otext *name)
 Return the current timestamp value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_GetInterval (OCI_Resultset *rs, unsigned int index)
 Return the current interval value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_GetInterval2 (OCI_Resultset *rs, const otext *name)
 Return the current interval value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_GetStatement (OCI_Resultset *rs, unsigned int index)
 Return the current cursor value (Nested table) of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_GetStatement2 (OCI_Resultset *rs, const otext *name)
 Return the current cursor value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_GetLob (OCI_Resultset *rs, unsigned int index)
 Return the current lob value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_GetLob2 (OCI_Resultset *rs, const otext *name)
 Return the current lob value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_File *OCI_API OCI_GetFile (OCI_Resultset *rs, unsigned int index)
 Return the current File value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_File *OCI_API OCI_GetFile2 (OCI_Resultset *rs, const otext *name)
 Return the current File value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_Object *OCI_API OCI_GetObject (OCI_Resultset *rs, unsigned int index)
 Return the current Object value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Object *OCI_API OCI_GetObject2 (OCI_Resultset *rs, const otext *name)
 Return the current Object value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_Coll *OCI_API OCI_GetColl (OCI_Resultset *rs, unsigned int index)
 Return the current Collection value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Coll *OCI_API OCI_GetColl2 (OCI_Resultset *rs, const otext *name)
 Return the current Collection value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_Ref *OCI_API OCI_GetRef (OCI_Resultset *rs, unsigned int index)
 Return the current Ref value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Ref *OCI_API OCI_GetRef2 (OCI_Resultset *rs, const otext *name)
 Return the current Ref value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_XmlType *OCI_API OCI_GetXmlType (OCI_Resultset *rs, unsigned int index)
 Return the current XmlType value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_XmlType *OCI_API OCI_GetXmlType2 (OCI_Resultset *rs, const otext *name)
 Return the current XmlType value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_Vector *OCI_API OCI_GetVector (OCI_Resultset *rs, unsigned int index)
 Return the current Vector value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Vector *OCI_API OCI_GetVector2 (OCI_Resultset *rs, const otext *name)
 Return the current Vector value of the column from its name in the result set.
 
OCI_SYM_PUBLIC OCI_Long *OCI_API OCI_GetLong (OCI_Resultset *rs, unsigned int index)
 Return the current Long value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC OCI_Long *OCI_API OCI_GetLong2 (OCI_Resultset *rs, const otext *name)
 Return the current Long value of the column from its name in the result set.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_IsNull (OCI_Resultset *rs, unsigned int index)
 Check if the current row value is null for the column at the given index in the result set.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataSize (OCI_Resultset *rs, unsigned int index)
 Return the size of the value of the column at the given index in the result set.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataSize2 (OCI_Resultset *rs, const otext *name)
 Return the size of the value of the column from its name in the result set.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_IsNull2 (OCI_Resultset *rs, const otext *name)
 Check if the current row value is null for the column of the given name in the result set.
 
OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_ResultsetGetStatement (OCI_Resultset *rs)
 Return the statement handle associated with a result set handle.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataLength (OCI_Resultset *rs, unsigned int index)
 Return the current row data length of the column at the given index in the result set.
 

Function Documentation

◆ OCI_GetResultset()

OCI_SYM_PUBLIC OCI_Resultset *OCI_API OCI_GetResultset ( OCI_Statement stmt)

#include <api.h>

Retrieve the result set handle from an executed statement.

Parameters
stmt- Statement handle
Note
See Fetching data for more details about which statements can return result sets.
Warning
If the statement has not been prepared and executed, no result set will be returned.
Returns
A result set handle on success, or NULL on failure.

Referenced by ocilib::Statement::GetResultset().

◆ OCI_ReleaseResultsets()

OCI_SYM_PUBLIC boolean OCI_API OCI_ReleaseResultsets ( OCI_Statement stmt)

#include <api.h>

Free the statement result sets.

Parameters
stmt- Statement handle
Note
This call is optional. Result sets are automatically freed when the statement is destroyed or when it is reused.
This function is useful for releasing large result sets when the application wants to keep the statement alive and does not know when it will be destroyed.
Returns
TRUE on success, otherwise FALSE.

◆ OCI_FetchNext()

OCI_SYM_PUBLIC boolean OCI_API OCI_FetchNext ( OCI_Resultset rs)

#include <api.h>

Fetch the next row of the result set.

Parameters
rs- Result set handle
Note
OCI_FetchNext() works for both forward-only and scrollable result sets.
Returns
TRUE on success, or FALSE if:
  • The result set is empty.
  • The last row has already been fetched.
  • An error occurred.

Referenced by ocilib::Resultset::Next().

◆ OCI_FetchPrev()

OCI_SYM_PUBLIC boolean OCI_API OCI_FetchPrev ( OCI_Resultset rs)

#include <api.h>

Fetch the previous row of the result set.

Parameters
rs- Result set handle
Note
OCI_FetchPrev() works ONLY for scrollable result sets.
Returns
TRUE on success, or FALSE if:
  • The result set is empty.
  • The first row has already been fetched.
  • An error occurred.

Referenced by ocilib::Resultset::Prev().

◆ OCI_FetchFirst()

OCI_SYM_PUBLIC boolean OCI_API OCI_FetchFirst ( OCI_Resultset rs)

#include <api.h>

Fetch the first row of the result set.

Parameters
rs- Result set handle
Note
OCI_FetchFirst() works ONLY for scrollable result sets.
Returns
TRUE on success, or FALSE if:
  • The result set is empty.
  • An error occurred.

Referenced by ocilib::Resultset::First().

◆ OCI_FetchLast()

OCI_SYM_PUBLIC boolean OCI_API OCI_FetchLast ( OCI_Resultset rs)

#include <api.h>

Fetch the last row of the result set.

Parameters
rs- Result set handle
Note
OCI_FetchLast() works ONLY for scrollable result sets.
Returns
TRUE on success, or FALSE if:
  • The result set is empty.
  • An error occurred.

Referenced by ocilib::Resultset::Last().

◆ OCI_FetchSeek()

OCI_SYM_PUBLIC boolean OCI_API OCI_FetchSeek ( OCI_Resultset rs,
unsigned int  mode,
int  offset 
)

#include <api.h>

Fetch the result set at a specific position.

Parameters
rs- Result set handle
mode- Fetch direction
offset- Fetch offset
Note
Possible values for the 'mode' parameter are:
  • OCI_SFD_ABSOLUTE : Seek to an absolute row position.
  • OCI_SFD_RELATIVE : Seek relative to the current row.
OCI_FetchSeek() works ONLY for scrollable result sets.
Warning
If you intend to use OCI_FetchSeek() on a scrollable statement and if any of the selected columns is a REF CURSOR or a nested table, you must set the fetch size to 1 using OCI_SetFetchSize() before calling OCI_GetResultset(). Otherwise, OCI_FetchSeek() will fail with an OCI-10002 error.
Returns
TRUE on success, or FALSE if:
  • The result set is empty.
  • An error occurred.
  • OCI_SetFetchMode() has not been called with OCI_SFM_SCROLLABLE.

Referenced by ocilib::Resultset::Seek().

◆ OCI_GetRowCount()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRowCount ( OCI_Resultset rs)

#include <api.h>

Retrieve the number of rows fetched so far.

Parameters
rs- Result set handle
Returns
The number of rows fetched.

Referenced by ocilib::Resultset::GetCount().

◆ OCI_GetCurrentRow()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetCurrentRow ( OCI_Resultset rs)

#include <api.h>

Retrieve the current row number.

Parameters
rs- Result set handle
Note
  • OCI_GetCurrentRow() returns the current row number starting from 1.
  • If the result set has not been fetched or is empty, it returns 0.
  • If the result set has been fully fetched, it returns the last fetched row number.
Returns
The current row number (1-based), or 0 as described above.

Referenced by ocilib::Resultset::GetCurrentRow().

◆ OCI_GetColumnCount()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetColumnCount ( OCI_Resultset rs)

#include <api.h>

Return the number of columns in the result set.

Parameters
rs- Result set handle
Returns
The number of columns.

Referenced by ocilib::Resultset::GetColumnCount().

◆ OCI_GetColumn()

OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_GetColumn ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the column object handle at the given index in the result set.

Parameters
rs- Result set handle
index- Column position (1-based)
Returns
The column handle on success, or NULL if the index is out of bounds.

Referenced by ocilib::Resultset::GetColumn().

◆ OCI_GetColumn2()

OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_GetColumn2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the column object handle from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Returns
The column handle on success, or NULL if no column is found with the given name.

Referenced by ocilib::Resultset::GetColumn().

◆ OCI_GetColumnIndex()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetColumnIndex ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the index of a column in the result set from its name.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Column indexes are 1-based in OCILIB.
Returns
The column index on success, or 0 if not found.

Referenced by ocilib::Resultset::GetColumnIndex().

◆ OCI_ColumnGetName()

OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetName ( OCI_Column col)

#include <api.h>

Return the name of the given column.

Parameters
col- Column handle
Returns
The column name string, or NULL on failure.

Referenced by ocilib::Column::GetName().

◆ OCI_ColumnGetType()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetType ( OCI_Column col)

#include <api.h>

Return the type of the given column.

Parameters
col- Column handle
Note
Possible values are :
  • OCI_CDT_NUMERIC : short, int, long long, float, double
  • OCI_CDT_DATETIME : OCI_Date *
  • OCI_CDT_TEXT : otext *
  • OCI_CDT_LONG : OCI_Long *
  • OCI_CDT_CURSOR : OCI_Statement *
  • OCI_CDT_LOB : OCI_Lob *
  • OCI_CDT_FILE : OCI_File *
  • OCI_CDT_TIMESTAMP : OCI_Timestamp *
  • OCI_CDT_INTERVAL : OCI_Interval *
  • OCI_CDT_RAW : void *
  • OCI_CDT_OBJECT : OCI_Object *
  • OCI_CDT_COLLECTION : OCI_Coll *
  • OCI_CDT_REF : OCI_Ref *
  • OCI_CDT_BOOLEAN : boolean
  • OCI_CDT_XMLTYPE : OCI_XmlType *
  • OCI_CDT_VECTOR : OCI_Vector *
Returns
The column type, or OCI_CDT_UNKNOWN on error.

Referenced by ocilib::Column::GetType().

◆ OCI_ColumnGetCharsetForm()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetCharsetForm ( OCI_Column col)

#include <api.h>

Return the charset form of the given column.

Parameters
col- Column handle
Note
Possible values are:
  • OCI_CSF_NONE : The column is not a character or LOB column.
  • OCI_CSF_DEFAULT : The column uses the server default character set.
  • OCI_CSF_NATIONAL : The column uses the national server character set.
Returns
The charset form value.

Referenced by ocilib::Column::GetCharsetForm().

◆ OCI_ColumnGetSQLType()

OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetSQLType ( OCI_Column col)

#include <api.h>

Return the Oracle SQL type name of the column data type.

Parameters
col- Column handle
Note
For possible values, consult Oracle documentation.
Returns
The SQL type name string, or NULL on failure.

Referenced by ocilib::Column::GetSQLType().

◆ OCI_ColumnGetFullSQLType()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetFullSQLType ( OCI_Column col,
otext *  buffer,
unsigned int  len 
)

#include <api.h>

Return the Oracle SQL Full name including precision and size of the column data type.

Parameters
col- Column handle
buffer- Buffer to store the full column type name and size
len- Maximum size of the buffer in characters
Note
This function returns a description that matches the one given by SQL*Plus.
Returns
The number of characters written into the buffer.

Referenced by ocilib::Column::GetFullSQLType().

◆ OCI_ColumnGetSize()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSize ( OCI_Column col)

#include <api.h>

Return the size of the column.

Parameters
col- Column handle
Note
For all types, the size is expressed in bytes, except for character-based columns that were created with a character-based size or of type NCHAR/NVARCHAR.
Returns
The column size.

Referenced by ocilib::Column::GetSize().

◆ OCI_ColumnGetScale()

OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetScale ( OCI_Column col)

#include <api.h>

Return the scale of the column for numeric columns.

Parameters
col- Column handle
Returns
The column scale.

Referenced by ocilib::Column::GetScale().

◆ OCI_ColumnGetPrecision()

OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetPrecision ( OCI_Column col)

#include <api.h>

Return the precision of the column for numeric columns.

Parameters
col- Column handle
Returns
The column precision.

Referenced by ocilib::Column::GetPrecision().

◆ OCI_ColumnGetFractionalPrecision()

OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetFractionalPrecision ( OCI_Column col)

#include <api.h>

Return the fractional precision of the column for timestamp and interval columns.

Parameters
col- Column handle
Returns
The fractional precision.

Referenced by ocilib::Column::GetFractionalPrecision().

◆ OCI_ColumnGetLeadingPrecision()

OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetLeadingPrecision ( OCI_Column col)

#include <api.h>

Return the leading precision of the column for interval columns.

Parameters
col- Column handle
Returns
The leading precision.

Referenced by ocilib::Column::GetLeadingPrecision().

◆ OCI_ColumnGetNullable()

OCI_SYM_PUBLIC boolean OCI_API OCI_ColumnGetNullable ( OCI_Column col)

#include <api.h>

Return the nullable attribute of the column.

Parameters
col- Column handle
Returns
TRUE if the column is nullable, otherwise FALSE.

Referenced by ocilib::Column::IsNullable().

◆ OCI_ColumnGetCharUsed()

OCI_SYM_PUBLIC boolean OCI_API OCI_ColumnGetCharUsed ( OCI_Column col)

#include <api.h>

Return TRUE if the length of the column is character-length, or FALSE if it is byte-length.

Parameters
col- Column handle
Note
This was introduced in Oracle 9i. For versions that do not support this property, it always returns FALSE.
Returns
TRUE if the column uses character-length semantics, otherwise FALSE.

Referenced by ocilib::Column::IsCharSemanticUsed().

◆ OCI_ColumnGetPropertyFlags()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetPropertyFlags ( OCI_Column col)

#include <api.h>

Return the column property flags.

Parameters
col- Column handle
Note
Possible flags are:
  • OCI_CPF_NONE : The column has no flags or the OCI client does not support this call.
  • OCI_CPF_IS_IDENTITY : The column is an IDENTITY column.
  • OCI_CPF_IS_GEN_ALWAYS : The value is "ALWAYS GENERATED".
  • OCI_CPF_IS_GEN_BY_DEFAULT_ON_NULL : The value is generated by default on NULL.
  • OCI_CPF_IS_LPART : The column is an implicitly generated logical partitioning column for a container_map enabled object.
  • OCI_CPF_IS_CONID : The column is a CON_ID column implicitly generated by CONTAINERS() or an ORIGIN_CON_ID column implicitly generated for Extended Data Link.
This was introduced in Oracle 12cR1. For earlier versions, it always returns OCI_CPF_NONE.
Returns
The column property flags.

Referenced by ocilib::Column::GetPropertyFlags().

◆ OCI_ColumnGetCollationID()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetCollationID ( OCI_Column col)

#include <api.h>

Return the column collation ID.

Parameters
col- Column handle

Possible values:

  • OCI_CCI_NONE
  • OCI_CCI_NLS_COMP
  • OCI_CCI_NLS_SORT
  • OCI_CCI_NLS_SORT_CI
  • OCI_CCI_NLS_SORT_AI
  • OCI_CCI_NLS_SORT_CS
  • OCI_CCI_NLS_SORT_VAR1
  • OCI_CCI_NLS_SORT_VAR1_CI
  • OCI_CCI_NLS_SORT_VAR1_AI
  • OCI_CCI_NLS_SORT_VAR1_CS
  • OCI_CCI_BINARY
  • OCI_CCI_BINARY_CI
  • OCI_CCI_BINARY_AI
Note
This was introduced in Oracle 12cR2. For earlier versions, it always returns OCI_CCI_NONE.
Returns
The collation ID value.

Referenced by ocilib::Column::GetCollationID().

◆ OCI_ColumnGetDimension()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetDimension ( OCI_Column col)

#include <api.h>

Return the column dimension (for VECTOR type)

Parameters
col- Column handle
Note
This was introduced in Oracle 23.4. When the vector has a flexible dimension, it returns 0. For earlier versions or column types other than VECTOR, it always returns 0.
Returns
The vector dimension, or 0 as described above.

Referenced by ocilib::Column::GetDimension().

◆ OCI_ColumnGetTypeInfo()

OCI_SYM_PUBLIC OCI_TypeInfo *OCI_API OCI_ColumnGetTypeInfo ( OCI_Column col)

#include <api.h>

Return the type information object associated with the column.

Parameters
col- Column handle
Note
This call is used only for Named Object typed and collection columns.
Returns
The type info handle, or NULL if the column is not a Named Object or a collection.

Referenced by ocilib::Column::GetTypeInfo().

◆ OCI_ColumnGetSubType()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSubType ( OCI_Column col)

#include <api.h>

Return the OCILIB object subtype of a column.

Parameters
col- Column handle
Note
This call is valid for the following OCILIB types:
  • OCI_CDT_LONG
  • OCI_CDT_LOB
  • OCI_CDT_FILE
  • OCI_CDT_TIMESTAMP
  • OCI_CDT_INTERVAL
  • OCI_CDT_NUMERIC

For OCI_Long type the possible values are:

  • OCI_BLONG
  • OCI_CLONG

For OCI_Lob type the possible values are:

  • OCI_BLOB
  • OCI_CLOB
  • OCI_NCLOB

For OCI_File type the possible values are:

  • OCI_BFILE
  • OCI_CFILE

For OCI_Timestamp type the possible values are:

  • OCI_TIMESTAMP
  • OCI_TIMESTAMP_TZ
  • OCI_TIMESTAMP_LTZ

For OCI_Interval type the possible values are:

  • OCI_INTERVAL_YM
  • OCI_INTERVAL_DS

For numeric columns the possible values are:

  • OCI_NUM_SHORT
  • OCI_NUM_INT
  • OCI_NUM_BIGINT
  • OCI_NUM_USHORT
  • OCI_NUM_UINT
  • OCI_NUM_BIGUINT
  • OCI_NUM_DOUBLE
  • OCI_NUM_FLOAT
  • OCI_NUM_NUMBER

    For vector columns the possible values are:

  • OCI_VEC_FLEX
  • OCI_VEC_FLOAT32
  • OCI_VEC_FLOAT64
  • OCI_VEC_INT8
  • OCI_VEC_BINARY
Warning
For numeric columns, the value may not be accurate. OCI does not provide the exact SQL type of a numeric column (int, real, etc.). OCI-based libraries can only infer some types in certain situations: float, binary_float, binary_double, number. For example:
  • With the statement 'SELECT 101 FROM dual', OCI reports numeric type NUMBER.
  • If a column is declared as "INT", OCI also reports NUMBER.
Note
For all other OCILIB types, it returns OCI_UNKNOWN.
Returns
The column subtype, or OCI_UNKNOWN if not applicable.

Referenced by ocilib::Column::GetSubType().

◆ OCI_SetStructNumericType()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetStructNumericType ( OCI_Resultset rs,
unsigned int  index,
unsigned int  type 
)

#include <api.h>

Set the numeric data type of the given structure member (identified by position in the result set) to retrieve when calling OCI_GetStruct()

Parameters
rs- Result set handle
index- Column position (1-based)
type- Numeric type
Note
Possible values for parameter 'type':
  • OCI_NUM_SHORT
  • OCI_NUM_USHORT
  • OCI_NUM_INT
  • OCI_NUM_UINT
  • OCI_NUM_BIGINT
  • OCI_NUM_BIGUINT
  • OCI_NUM_DOUBLE
  • OCI_NUM_FLOAT
  • OCI_NUM_NUMBER
Returns
TRUE on success, otherwise FALSE.

◆ OCI_SetStructNumericType2()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetStructNumericType2 ( OCI_Resultset rs,
const otext *  name,
unsigned int  type 
)

#include <api.h>

Set the numeric data type of the given structure member (identified by column name in the result set) to retrieve when calling OCI_GetStruct()

Parameters
rs- Result set handle
name- Column name
type- Numeric type
Note
Possible values for parameter 'type':
  • OCI_NUM_SHORT
  • OCI_NUM_USHORT
  • OCI_NUM_INT
  • OCI_NUM_UINT
  • OCI_NUM_BIGINT
  • OCI_NUM_BIGUINT
  • OCI_NUM_DOUBLE
  • OCI_NUM_FLOAT
  • OCI_NUM_NUMBER
Returns
TRUE on success, otherwise FALSE.

◆ OCI_GetStruct()

OCI_SYM_PUBLIC boolean OCI_API OCI_GetStruct ( OCI_Resultset rs,
void *  row_struct,
void *  row_struct_ind 
)

#include <api.h>

Return the row column values into a single structure.

Parameters
rs- Result set handle
row_struct- Pointer to user row structure
row_struct_ind- Pointer to user indicator structure
Note
Structure member values are contextual to the current row. The returned values can go out of scope when the current row changes by calling any OCI_FetchXXX() function.
User row structure

The user structure must have the same members as the result set. Each column in the result set must have its equivalent in the structure. Fields must be in the same order.

The mapping rules are:

  • LOBs (CLOB, NCLOB, BLOB) : OCI_Lob *
  • DATE : OCI_Date *
  • TIMESTAMPS : OCI_Timestamp *
  • INTERVALS : OCI_Interval *
  • LONG, LONG RAW : OCI_Long *
  • REFs : OCI_Ref *
  • CURSOR, RESULTSET : OCI_Statement *
  • OBJECTS, UDT : OCI_Object *
  • Character columns (CHAR, VARCHAR, etc.) : otext *
  • All NUMERIC types:

The user structure pointer is not mandatory.

User row indicator structure

This structure must have one boolean field per column in the result set and in the same member order.

If the value of the given member is TRUE, it means the value in the user row structure is NOT NULL; otherwise, it is NULL.

The user indicator structure pointer is mandatory.

Returns
TRUE on success, otherwise FALSE.

◆ OCI_GetNumber()

OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_GetNumber ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current Number value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetNumber2()

OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_GetNumber2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current number value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetShort()

OCI_SYM_PUBLIC short OCI_API OCI_GetShort ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current short value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetShort2()

OCI_SYM_PUBLIC short OCI_API OCI_GetShort2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current short value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetUnsignedShort()

OCI_SYM_PUBLIC unsigned short OCI_API OCI_GetUnsignedShort ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current unsigned short value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetUnsignedShort2()

OCI_SYM_PUBLIC unsigned short OCI_API OCI_GetUnsignedShort2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current unsigned short value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetInt()

OCI_SYM_PUBLIC int OCI_API OCI_GetInt ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current integer value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetInt2()

OCI_SYM_PUBLIC int OCI_API OCI_GetInt2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current integer value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetUnsignedInt()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetUnsignedInt ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current unsigned integer value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetUnsignedInt2()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetUnsignedInt2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current unsigned integer value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetBigInt()

OCI_SYM_PUBLIC big_int OCI_API OCI_GetBigInt ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current big integer value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetBigInt2()

OCI_SYM_PUBLIC big_int OCI_API OCI_GetBigInt2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current big integer value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetUnsignedBigInt()

OCI_SYM_PUBLIC big_uint OCI_API OCI_GetUnsignedBigInt ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current unsigned big integer value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetUnsignedBigInt2()

OCI_SYM_PUBLIC big_uint OCI_API OCI_GetUnsignedBigInt2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current unsigned big integer value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetString()

OCI_SYM_PUBLIC const otext *OCI_API OCI_GetString ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current string value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
OCI_GetString() performs an implicit conversion from the following data types:
  • Numerics (based on the current connection handle numeric format).
  • Binary doubles and floats (using the standard C library functions).
  • OCI_Number (based on the current connection handle numeric format).
  • OCI_Date (based on the current connection handle date format).
  • OCI_Timestamp (based on the current connection handle date format).
  • OCI_Interval (based on Oracle default conversion).
  • OCI_Lob (for BLOBs, output is expressed in hexadecimal).
  • OCI_Long (for BLONGs, output is expressed in hexadecimal).
  • OCI_File ("[directory]/[name]" will be output).
  • OCI_Object (textual SQL string representation).
  • OCI_Coll (textual SQL string representation).
  • RAW buffer (expressed in hexadecimal).
  • OCI_Statement (SQL statement string or cursor name).
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetString2()

OCI_SYM_PUBLIC const otext *OCI_API OCI_GetString2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current string value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetRaw()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRaw ( OCI_Resultset rs,
unsigned int  index,
void *  buffer,
unsigned int  len 
)

#include <api.h>

Copy the current raw value of the column at the given index into the specified buffer.

Parameters
rs- Result set handle
index- Column position
buffer- Buffer to receive the raw value
len- Maximum size of the buffer in bytes
Note
Column position starts at 1.
Returns
The number of bytes copied into the buffer on success, or 0 on failure.

◆ OCI_GetRaw2()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRaw2 ( OCI_Resultset rs,
const otext *  name,
void *  buffer,
unsigned int  len 
)

#include <api.h>

Copy the current raw value of the column from its name into the specified buffer.

Parameters
rs- Result set handle
name- Column name
buffer- Buffer to receive the raw value
len- Maximum size of the buffer in bytes
Note
The column name is case-insensitive.
Returns
The number of bytes copied into the buffer on success, or 0 on failure.

◆ OCI_GetDouble()

OCI_SYM_PUBLIC double OCI_API OCI_GetDouble ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current double value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0.0 if index is out of bounds

◆ OCI_GetDouble2()

OCI_SYM_PUBLIC double OCI_API OCI_GetDouble2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current double value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Returns
The column current row value or 0.0 if no column found with the given name

◆ OCI_GetFloat()

OCI_SYM_PUBLIC float OCI_API OCI_GetFloat ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current float value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0.0 if index is out of bounds

◆ OCI_GetFloat2()

OCI_SYM_PUBLIC float OCI_API OCI_GetFloat2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current float value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Note
The column name is case-insensitive.
Returns
The column current row value or 0.0 if no column found with the given name

◆ OCI_GetDate()

OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_GetDate ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current date value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetDate2()

OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_GetDate2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current date value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetTimestamp()

OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_GetTimestamp ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current timestamp value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetTimestamp2()

OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_GetTimestamp2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current timestamp value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetInterval()

OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_GetInterval ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current interval value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetInterval2()

OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_GetInterval2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current interval value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetStatement()

OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_GetStatement ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current cursor value (Nested table) of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetStatement2()

OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_GetStatement2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current cursor value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetLob()

OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_GetLob ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current lob value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetLob2()

OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_GetLob2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current lob value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetFile()

OCI_SYM_PUBLIC OCI_File *OCI_API OCI_GetFile ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current File value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetFile2()

OCI_SYM_PUBLIC OCI_File *OCI_API OCI_GetFile2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current File value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetObject()

OCI_SYM_PUBLIC OCI_Object *OCI_API OCI_GetObject ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current Object value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetObject2()

OCI_SYM_PUBLIC OCI_Object *OCI_API OCI_GetObject2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current Object value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetColl()

OCI_SYM_PUBLIC OCI_Coll *OCI_API OCI_GetColl ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current Collection value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

Referenced by ocilib::Resultset::Get().

◆ OCI_GetColl2()

OCI_SYM_PUBLIC OCI_Coll *OCI_API OCI_GetColl2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current Collection value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

Referenced by ocilib::Resultset::Get().

◆ OCI_GetRef()

OCI_SYM_PUBLIC OCI_Ref *OCI_API OCI_GetRef ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current Ref value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetRef2()

OCI_SYM_PUBLIC OCI_Ref *OCI_API OCI_GetRef2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current Ref value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetXmlType()

OCI_SYM_PUBLIC OCI_XmlType *OCI_API OCI_GetXmlType ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current XmlType value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetXmlType2()

OCI_SYM_PUBLIC OCI_XmlType *OCI_API OCI_GetXmlType2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current XmlType value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetVector()

OCI_SYM_PUBLIC OCI_Vector *OCI_API OCI_GetVector ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current Vector value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetVector2()

OCI_SYM_PUBLIC OCI_Vector *OCI_API OCI_GetVector2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current Vector value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetLong()

OCI_SYM_PUBLIC OCI_Long *OCI_API OCI_GetLong ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current Long value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetLong2()

OCI_SYM_PUBLIC OCI_Long *OCI_API OCI_GetLong2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current Long value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_IsNull()

OCI_SYM_PUBLIC boolean OCI_API OCI_IsNull ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Check if the current row value is null for the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
TRUE if the value is null, otherwise FALSE.

Referenced by ocilib::Resultset::IsColumnNull().

◆ OCI_GetDataSize()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataSize ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the size of the value of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Warning
For binds of type OCI_CDT_TEXT (strings), the returned value is expressed in number of characters.
Returns
The value size, or 0 if the value is NULL.

◆ OCI_GetDataSize2()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataSize2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the size of the value of the column from its name in the result set.

Parameters
rs- Result set handle
name- Column name
Warning
For binds of type OCI_CDT_TEXT (strings), the returned value is expressed in number of characters.
Returns
The value size, or 0 if the value is NULL.

◆ OCI_IsNull2()

OCI_SYM_PUBLIC boolean OCI_API OCI_IsNull2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Check if the current row value is null for the column of the given name in the result set.

Parameters
rs- Result set handle
name- Column name
Returns
TRUE if the value is null, otherwise FALSE.

Referenced by ocilib::Resultset::IsColumnNull().

◆ OCI_ResultsetGetStatement()

OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_ResultsetGetStatement ( OCI_Resultset rs)

#include <api.h>

Return the statement handle associated with a result set handle.

Parameters
rs- Result set handle
Returns
The statement handle, or NULL on failure.

Referenced by ocilib::Resultset::GetStatement().

◆ OCI_GetDataLength()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataLength ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current row data length of the column at the given index in the result set.

Parameters
rs- Result set handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row data length, or 0 if the index is out of bounds.