XMLParser Example 2: Ancestor - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
lmf1502735330121
Product Category
Teradata Vantage

SQL Call

SELECT * FROM XMLParser (
  ON xml_input1
  USING
  TextColumn ('xmldocument')
  Nodes ('temperature/read:type', 'storage/{used, total}')
  Sibling ('settopid:{type, length}', 'accountid')
  Ancestor ('setTopRpt')
  OutputColumn_NodeID ('nid')
  MaxItemNum (1)
  Accumulate ('xid')
) AS dt ORDER BY 1,2;

Output

The output table has the node and sibling values of the specified ancestor, setTopRpt.

xid nid out_parent_node settopid settopid:type settopid:length accountid read read:type used total
2 1 temperature ST789 string 5 8728 46 bigDecimal    
2 2 storage ST789 string 5 8728     98 300