17.10 - XMLFOREST Syntax - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - XML Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1140-171K
Language
English (United States)
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.