17.10 - Example: Using EXISTSNODE to Check If a Query Will Return a Result - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - XML Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1140-171K
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