XMLELEMENT Function | XML Data Type | Teradata Vantage - XMLELEMENT - Advanced SQL Engine - Teradata Database

XML Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
amr1556233250442.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1140
lifecycle
previous
Product Category
Teradata Vantageā„¢

Constructs an XML element node.

Syntax

XMLELEMENT (
  NAME XML_element_name

  [, XML_namespace_declaration ]

  [, ( XML_attribute_spec [,...] ) ]

  [, XML_value_expr
    [ 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.
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.
XML_attribute_spec
XML_attribute_value [ AS XML_attribute_name ]
XML_element_name
The name of the element.
XML_value_expr
An instance of the XML type representing the XML element content.
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 a document node with one or more child element nodes.
RETURNING SEQUENCE
The return value is a sequence (an ordered collection of items, each of which can either be a valid Xquery node or atomic value). This is the default.
'XML_namespace_URI'
The URI (Uniform Resource Identifier) that identifies the XML namespace.
XML_namespace_prefix
The URI (Uniform Resource Identifier) that identifies the XML namespace.
XML_attribute_value
A value for an attribute of the element.
XML_attribute_name
A name for the attribute. The name cannot be 'xmlns' and no two attributes can have the same qualified name (for example, same namespace and local name).