16.20 - Example: XQuery/XPath Query Returns a Sequence of xs:integer or xs:double Values - 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)
This query returns a sequence of xs:integer or xs:double values depending on the value of the total element in the XML document:
SELECT CAST(XMLQUERY('for $cust in /customers/customer return sum(order/total)' passing
xmldoc) AS VARCHAR(512))
AS ordertotals
FROM xmltab;
The result of this query is the following string value of type VARCHAR (XQuery cast of each item to xs:string, separated by a single white space character):
2496.50 1383.50