XMLExistsNode() function
The XMLExistsNode() function determines whether using an XPath to traverse an XML input document results in at least a single XML element or text node.
When you use the XMLExistsNode() function in a query, you must specify the function in the WHERE clause, not in the SELECT list.
Syntax
bool = XMLExistsNode(XML input, varchar XPath);
The input value specifies a
compiled representation of an XML
file.
The XPath value specifies the
XPath of the XML node to
extract.
Returns
The function returns t if the XPath leads to an XML element or text node in the XML input object. Otherwise, the function returns f.
Example
This example returns rows from MAILINGLIST only if nodes exist that satisfy the condition:SELECT person
FROM MAILINGLIST
WHERE XMLExistsNode(person,'/MailingList[Occupation=“Doctor“]') = 1;