Complex data types

A complex data type is usually a composite of other existing data types. For example, you might create a complex data type whose components include built-in types, opaque types, distinct types, or other complex types. An important advantage that complex data types have over user-defined types is that users can access and manipulate the individual components of a complex data type.

In contrast, built-in types and user-defined types are self-contained (encapsulated) data types. Consequently, the only way to access the component values of an opaque data type is through functions that you define on the opaque type.

The following figure shows the complex data types that supports and the syntax that you use to create the complex data types.
Figure 1: Complex Data Types

begin figure description - This figure is described in the surrounding text. - end figure description

The complex data types that the previous figure illustrates provide the following extended data type support:
Collection types
You can use a collection type whenever you must store and manipulate collections of data within a table cell. You can assign collection types to columns.
Row types
A row type typically contains multiple fields. When you want to store more than one kind of data in a column or variable, you can create a row type. Row types come in two kinds: named row types and unnamed row types. You can assign an unnamed row type to columns and variables. You can assign a named row type to columns, variables, tables, or views. When you assign a named row type to a table, the table is a typed table. A primary advantage of typed tables is that they can be used to define an inheritance hierarchy.

For more information about how to perform SELECT, INSERT, UPDATE, and DELETE operations on the complex data types that this chapter describes, see the HCL OneDB™ Guide to SQL: Tutorial.