OraCollection Object
Description
The OraCollection interface represents Oracle collection types, such as
variable-length arrays (VARRAYs) and Nested Tables.
Remarks
A Collection is an ordered group of elements, all of the same type. For
example, the students in a class or the grades for each student in a class. Each
element has a unique subscript, called an index, that determines its position in
the collection.
The Collection type ‘Nested Table’ is viewed as a table stored in the column of database tables. When retrieved,
rows of a Nested Table are given consecutive subscripts starting at 1.
Individual rows are accessed using an array-like access.
The Collection type ‘VARRAY’ is viewed as array stored in the column of database tables. To reference an
element in a VARRAY, standard subscripting syntax can be used. For example,
Grade(3) references the third element in VARRAY named Grades.
The OraCollection provides methods for accessing and manipulating an Oracle
collection. Implicitly an OraCollection contains a OLE automation collection
interface for accessing and manipulating (updating and inserting) individual
elements of an Oracle collection. Individual elements can be accessed by using a
subscript. An OraCollection element index starts at 1.
Element values are retrieved as Variant types. The Variant type of the element
depends on the element type of the collection . Element values can be Null and
can be set to Null. For elements of type objects and REFs, element values are
returned as corresponding OO4O objects for that type. VARRAYs and Nested tables
do not support the elements of LOBs, VARRAYs, and Nested tables. The following
table shows the element type and return value of the elements.
Element Type
| Element Value
|
Object
| OraObject
|
REF
| OraRef
|
Date
| String
|
Number
| String
|
CHAR,VARCHAR2
| String
|
Real
| Real
|
Integer
| Integer
|
Element values are converted into a Variant SAFEARRAY format using the SafeArray Property. Elements of primitive types are only supported. A Variant SAFEARRAY index
starts at 0.
The CreateOraObject method on the OraDatabase object returns the OraCollection. The Oracle
collection associated with this OraCollection is created in the client side object
cache.
For information on initializing an OraCollection representing an Oracle
collection in OO4O, see Initializing Oracle LOBs, Objects, and Collection. For information on creating a dynaset from a collection, refer to Creating a Dynaset from an OraCollection.