Reference Guide > TDV Support for SQL Functions > TDV-Supported XML Functions > XMLDOCUMENT
 
XMLDOCUMENT
The XMLDOCUMENT function generates an XML value with a single XQuery document node. It is equivalent to running the XQUERY expression.
Syntax
XMLDOCUMENT ( <XML_value_expression> [ <XML_returning_clause> ] )
 
The <XML_value_expression> is a sequence of nodes of atomic values.
Example
SELECT XMLDOCUMENT (XMLELEMENT (name Details, XMLATTRIBUTES (ProductID as product),
XMLELEMENT (name orderno, OrderID),
XMLELEMENT (name status, Status),
XMLELEMENT (name price, UnitPrice))) myXMLDocument
FROM /shared/examples/ds_orders/orderdetails
WHERE ProductID < 20