Reference Guide > TDV Support for SQL Functions > TDV-Supported XML Functions > XMLFOREST
 
XMLFOREST
The XMLFOREST function creates a series of XML nodes, with the arguments being the children of each node. XMLFOREST accepts one or more arguments.
Syntax
XMLFOREST ( [ <XML_namespace_declaration>. ] <forest_element_list>
[ OPTION <XML_content_option> ]
[ <XML_returning_clause> ]
)
Remarks
Each argument to XMLFOREST can be followed by an optional alias. The alias becomes the name of the XML node and the argument becomes a child of that node.
If no alias is specified and the argument is a column, the name of the column is the name of the XML node.
If an argument is not a column, an error is generated.
If an argument evaluates to a character literal, the resulting string is escaped.
Example
SELECT XMLFOREST (CompanyName AS name, City AS city) AS
NameAndCityOfCompany
FROM /shared/examples/ds_orders/customers