Using the following query,
SELECT *
FROM sampletable
WHERE XMLExists('/books/book[@max="30"]' passing XMLCOLUMN);
But I want to know , how to check for the plain text content of an element, like
SELECT *
FROM sampletable
WHERE XMLExists('/books/book="Content"' passing XMLCOLUMN);
To check if there is a book
node where the text node equals Content
(from XPath terms it would return all book nodes), do:
SELECT *
FROM sampletable
WHERE XMLExists('/books/book[.="Content"]';
To check if there are books
nodes where the child node equals Content
(from XPath terms it would return all books nodes), do:
SELECT *
FROM sampletable
WHERE XMLExists('/books[book="Content"]';