16.20 - Example: Using EXISTSNODE to Check If a Query Will Return a Result - 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 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