DB2 10.5 for Linux, UNIX, and Windows

Ordering mode declaration

An ordering mode declaration in the query prolog sets the ordering mode for the query. The ordering mode defines the ordering of nodes in the query result.

Because DB2® XQuery does not support ordered mode as defined in XQuery 1.0: An XML Query Language, the ordering mode declaration, if present, must specify unordered. For the rules that govern the order of query results in DB2 XQuery, see Order of results in XQuery expressions.

The query prolog can contain only one ordering mode declaration. An ordering mode declaration that specifies a value other than unordered results in an error.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-declare--ordering--unordered--;-----------------------------><

unordered
Specifies that the rules for ordered mode in XQuery 1.0: An XML Query Language are not in effect. For the rules that govern the order of query results in DB2 XQuery, see Order of results in XQuery expressions.

Example

The following declaration is valid, but it does not change the default behavior of ordering because DB2 XQuery supports only unordered mode:

declare ordering unordered;