XMLFOREST Syntax - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
XMLFOREST (
  [ XML_namespace_declaration , ]

  [ forest_element_spec [,...] ]

  [ OPTION
    {
      { NULL | EMPTY | ABSENT | NIL } ON NULL |
        NIL ON NO CONTENT
    }
  ]

  [ RETURNING { CONTENT | SEQUENCE } ]
)
You can include only one default namespace declaration item. It can appear in any position in the list of comma-separated namespace declarations or at the end of the list.

Syntax Elements

XML_namespace_declaration
XMLNAMESPACES (
  { 'XML_namespace_URI' AS XML_namespace_prefix |
    DEFAULT 'XML_namespace_URI' |
    NO DEFAULT
  } [,...]
)

XML namespaces that are scoped when the query expressions (row and column) are evaluated.

Namespaces declared in the prolog of the queries override any namespace declarations specified here.
forest_element_spec
forest_element_value [ AS forest_element_name ]
OPTION
NULL ON NULL
EMPTY ON NULL
ABSENT ON NULL
NIL ON NULL
NIL ON NO CONTENT
XML content options.
RETURNING CONTENT
The return value is an XQuery document node with the forest elements as its children.
RETURNING SEQUENCE
The return value is a sequence with the forest elements as items. This is the default.
'XML_namespace_URI'
The URI (Uniform Resource Identifier) that identifies the XML namespace.
XML_namespace_prefix
The namespace prefix.
forest_element_value
A value for the forest element.
forest_element_name
A name for the forest element.
If forest_element_name is specified, the name is converted to an XML name. The resulting name is a QName. forest_element_name must be a NAME such as "ELEMENTNAME".
If forest_element_name is not specified, forest_element_value must be a column reference and the column name is converted to an XML name. The resulting name is a QName. forest_element_value can be of any Teradata predefined data type or XML.
The effect of the XML content option is the same as for XMLELEMENT for each individual forest element constructed.