This section describes how to query columns that are defined
on collection types. A collection type is a complex data
type in which each collection value contains a group of elements of
the same data type. For a detailed description of collection data
types, see the HCL OneDB™ Database Design
and Implementation Guide.
For information about how to access the individual elements that a
collection contains, see Handle collections in SELECT statements.
The
following figure shows the manager table, which is used in
examples throughout this section. The manager table contains
both simple and nested collection types. A simple collection is
a collection type that does not contain any fields that are themselves
collection types. The direct_reports column of the manager table
is a simple collection. A nested collection is a collection
type that contains another collection type. The projects column
of the manager table is a nested collection.
A query on a column that is a collection type returns,
for each row in the table, all the elements that the particular collection
contains. For example, the following query shows a query that returns
data in the department column and all elements in the direct_reports column
for each row of the manager table.
The output of a query on a collection type always includes
the type constructor that specifies whether the collection is a SET,
MULTISET, or LIST. For example, in the result, the SET constructor
precedes the elements of each collection. Braces ({}) demarcate the
elements of a collection; commas separate individual elements of a
collection.