DB2 10.5 for Linux, UNIX, and Windows

Sequences and items

An instance of the XQuery and XPath data model (XDM) is a sequence. A sequence is an ordered collection of zero or more items. An item is either an atomic value or a node.

A sequence can contain nodes, atomic values, or any mixture of nodes and atomic values. For example, each entry in the following list is a sequence:

In addition the entries in the list, an XML document stored in an XML column in a DB2® database is a sequence.

The examples use a notation to represent sequences that is consistent with the syntax that is used to construct sequences in XQuery:

Sequences cannot be nested. When two sequences are combined, the result is always a flattened sequence of nodes and atomic values. For example, appending the sequence (2, 3) to the sequence (3, 5, 6) results in the single sequence (3, 5, 6, 2, 3). Combining these sequences does not produce the sequence (3, 5, 6, (2, 3)) because nested sequences never occur.

A sequence that contains zero items is called an empty sequence. Empty sequences can be used to represent missing or unknown information.