16.20 - Example: Using EXISTSNODE to Check If a Query Will Return a Result - Teradata Vantage NewSQL Engine

Teradata Vantageā„¢ XML Data Type

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
created_date
March 2019
category
Programming Reference
featnum
B035-1140-162K

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