16.20 - Examples: Using XMLDOCUMENT to Create an XML Document Node From an XML Type Value - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantageā„¢ XML Data Type

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Release Date
March 2019
Content Type
Programming Reference
Publication ID
B035-1140-162K
Language
English (United States)
The following query returns an XML document node with a child element named 'Customer':
SELECT XMLDOCUMENT(new XML('<Customer/>'));
Query result:
XMLDOCUMENT( NEW XML('<Customer/>') RETURNING SEQUENCE )
--------------------------------------------------------
<Customer></Customer>
The following query returns an XML document node with two child elements named 'Name' and 'Address'. This is not a well-formed document according to the XML1.1 specification, but is allowed by the XQuery data model.
SELECT XMLDOCUMENT(XMLQUERY('(<Name/>, <Address/>)') RETURNING CONTENT);
Query result:
XMLDOCUMENT(XMLQUERY('(<Name/>, <Address/>)') RETURNING CONTENT)
----------------------------------------------------------------
<Name></Name><Address></Address>