Example: Using EXISTSNODE to Check If a Query Will Return a Result - 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 all ids in the customer table for which the corresponding XML document in the column customerXML has an element named customer whose Name child element has the value "John Hancock".

SELECT customerID
FROM customer
WHERE customerXML.EXISTSNODE('/Customer[Name="John Hancock"]', '') = 1;

Query result:

customerID
-----------
          1