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

Teradata Vantageā„¢ XML Data Type

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1140-162K
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>