Collection data types
Collection data types enable you to store and manipulate collections of data within a single row of a table. A collection data type has two components: a type constructor, which determines whether the collection type is a SET, MULTISET, or LIST, and an element type, which specifies the type of data that the collection can contain. (The SET, MULTISET, and LIST collection types are described in detail in the following sections.)
The elements of a collection can be of most any data type. (For
a list of exceptions, see Restrictions on collections.)
The elements of a collection are the values that the
collection contains. In a collection that contains the values: {'blue',
'green', 'yellow', and 'red'}, 'blue'
represents a single
element in the collection. Every element in a collection must be of
the same type. For example, a collection whose element type is INTEGER
can contain only integer values.
col_1 SET(INTEGER NOT NULL)
col_2 SET(ROW(name VARCHAR(20), salary INTEGER) NOT NULL)
- Select and modify individual elements of a collection (from Informix® ESQL/C programs only).
- Count the number of elements that a collection contains.
- Determine if certain values are in a collection.
For information about the syntax that you use to create collection data types, see the Data Type segment in the Informix® Guide to SQL: Syntax. For information about how to convert a value of one collection type to another collection type, see the Informix® Guide to SQL: Tutorial.