Table 19-17 describes the OCI table functions that are described in this section.
Function | Purpose |
---|---|
Delete element |
|
Test whether element exists |
|
Return first index of table |
|
Return last index of table |
|
Return next available index of table |
|
Return previous available index of table |
|
Return current size of table |
The OCI environment handle initialized in object mode.
The OCI error handle. If there is an error, it is recorded in err
, and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet().
Index of the element that must be deleted.
Table whose element is deleted.
This function returns an error if the element at the given index has already been deleted or if the given index is not valid for the given table.
Note:
The position ordinals of the remaining elements of the table are not changed byOCITableDelete()
. The delete operation creates holes in the table.sword OCITableExists ( OCIEnv *env, OCIError *err, const OCITable *tbl, sb4 index, boolean *exists );
The OCI environment handle initialized in object mode.
The OCI error handle. If there is an error, it is recorded in err
, and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet().
Table in which the given index is checked.
Index of the element that is checked for existence.
Set to TRUE
if the element at the given index
exists; otherwise, it is set to FALSE
.
The OCI environment handle initialized in object mode.
The OCI error handle. If there is an error, it is recorded in err
, and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet().
Table to scan.
First index of the element that exists in the given table that is returned.
If OCITableDelete()
deletes the first five elements of a table, OCITableFirst()
returns the value 6.
The OCI environment handle initialized in object mode.
The OCI error handle. If there is an error, it is recorded in err
, and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet().
Table to scan.
Index of the last existing element in the table.
OCITableLast()
returns the largest index numbered element in the index by integer collection.
sword OCITableNext ( OCIEnv *env, OCIError *err, sb4 index, const OCITable *tbl, sb4 *next_index boolean *exists );
The OCI environment handle initialized in object mode.
The OCI error handle. If there is an error, it is recorded in err
, and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet().
Index for the starting point of the scan.
Table to scan.
Index of the next existing element after tbl
(index
).
FALSE
if no next index is available; otherwise, TRUE
.
Returns the smallest position j
, greater than index
, such that exists(j)
is TRUE
.
See Also:
The description of OCITableSize() for information about the existence of non-data holes (deleted elements) in tablessword OCITablePrev ( OCIEnv *env, OCIError *err, sb4 index, const OCITable *tbl, sb4 *prev_index boolean *exists );
The OCI environment handle initialized in object mode.
The OCI error handle. If there is an error, it is recorded in err
, and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet().
Index for the starting point of the scan.
Table to scan.
Index of the previous existing element before tbl
(index
).
FALSE
if no previous index is available; otherwise, TRUE
.
Returns the largest position j
, less than index
, such that exists (j)
is TRUE
.
See Also:
The description of OCITableSize() for information about the existence of non-data holes (deleted elements) in tablesThe OCI environment handle initialized in object mode.
The OCI error handle. If there is an error, it is recorded in err
, and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet().
Nested table whose number of elements is returned.
Current number of elements in the nested table. The count does not include deleted elements.
The count is decremented when elements are deleted from the nested table. So this count does not include any holes created by deleting elements. To get the count including the holes created by the deleted elements, use OCICollSize().
Example 19-4 shows a code fragment where an element is deleted from a nested table.
Example 19-4 Deleting an Element from a Nested table
OCITableSize(...); // assume 'size' returned is equal to 5 OCITableDelete(...); // delete one element OCITableSize(...); // 'size' returned is equal to 4
To get the count plus the count of deleted elements, use OCICollSize(), as shown in Example 19-5. Continuing Example 19-4.
This function returns an error if an error occurs during the loading of the nested table into the object cache, or if any of the input parameters is NULL
.