17.10 - Example: XQuery/XPath Query Returns a Sequence of xs:integer or xs:double Values - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - XML Data Type

Advanced SQL Engine
Teradata Database
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
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