XMLEXISTS is an SQL/XML operator that you can use to query XML values in SQL.
The XMLEXISTS operator has two arguments, an XML query expression and a Derby XML value.
XMLEXISTS ( xquery-string-literal PASSING BY REF xml-value-expression [ BY REF ] )
The XMLEXISTS operator does not return the actual results from the evaluation of the query. You must use the XMLQUERY operator to retrieve the actual results.
Since the result of the XMLEXISTS operator is an SQL boolean data type, you can use the XMLEXISTS operator wherever a boolean function is allowed. For example, you can use the XMLEXISTS operator as a check constraint in a table declaration or as a predicate in a WHERE clause.
SELECT id, XMLEXISTS('//student[@age=20]' PASSING BY REF xcol) FROM x_table
SELECT id FROM x_table WHERE XMLEXISTS('/roster/student' PASSING BY REF xcol)
CREATE TABLE x_table ( id INT, xcol XML CHECK (XMLEXISTS ('//student[@age < 25]' PASSING BY REF xcol)) )
Derby requires that a JAXP parser, such as Apache Xerces, and that Apache Xalan are listed in the Java classpath for the XML functions to work. If either the JAXP parser or Xalan is missing from the classpath, attempts to use the XMLEXISTS operator will result in an error.