XML values

An XML value represents well-formed XML in the form of an XML document, XML content, or a sequence of XML nodes.

An XML value that is stored in a table as a value of a column defined with the XML data type must be a well-formed XML document. XML values are processed in an internal representation that is not comparable to any string value. An XML value can be transformed into a serialized string value representing the XML document using the XMLSERIALIZE function. Similarly, a string value that represents an XML document can be transformed into an XML value using the XMLPARSE function. An XML value can be implicitly parsed or serialized when exchanged with application string and binary data types.

Special restrictions apply to expressions that result in an XML data type value; such expressions and columns are not permitted in (SQLSTATE 42818):
  • A SELECT list preceded by the DISTINCT clause
  • A GROUP BY clause
  • An ORDER BY clause
  • A subselect of a set operator other than UNION ALL
  • A basic, quantified, BETWEEN, IN, or LIKE predicate
  • An aggregate function with DISTINCT