Example: XQuery/XPath Query Returns a Sequence of xs:integer or xs:double Values - Analytics Database - Teradata Vantage

Teradata Vantageā„¢ - XML Data Type - 17.20

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-01-27
dita:mapPath
tkc1628112506748.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
dgs1472251600184
Product Category
Teradata Vantage
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