1.1

Table Of Contents
XMLEXISTS operator
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 SQLFire XML value.
Syntax
XMLEXISTS ( xquery-string-literal
PASSING BY REF xml-value-expression [ BY REF ] )
Must be specied as a string literal. If this argument is specied as a parameter,
an expression that is not a literal, or a literal that is not a string (for example an
xquery-string-literal
integer), SQLFire throws an error. The xquery-string-literal argument
must also be an XPath expression that is supported by Apache Xalan. SQLFire
uses Apache Xalan to evaluate all XML query expressions. Because Xalan does
not support full XQuery, neither does SQLFire. If Xalan is unable to compile
or execute the query argument, SQLFire catches the error that is thrown by
Xalan and throws the error as a SQLException. For more on XPath and XQuery
expressions, see these Web sites: http://www.w3.org/TR/xpath and
http://www.w3.org/TR/xquery/.
Must be an XML data value and must constitute a well-formed SQL/XML
document. The xml-value-expression argument cannot be a parameter.
xml-value-expression
SQLFire does not perform implicit parsing nor casting of XML values, so use
of strings or any other data type results in an error. If the argument is a sequence
that is returned by the SQLFire XMLQUERY operator on page 576, the argument
is accepted if it is a sequence of exactly one node that is a document node.
Otherwise SQLFire throws an error.
Optional keywords that describe the only value passing mechanism supported
by SQLFire. Since BY REF is also the default passing mechanism, the
BY REF
XMLEXISTS operator behaves the same whether the keywords are present or
not. For more information on passing mechanisms, see the SQL/XML
specication.
Operator results and combining with other operators
The result of the XMLEXISTS operator is a SQL boolean value that is based on the results from evaluating the
xquery-string-literal against the xml-value-expression. The XMLEXISTS operator returns:
When the xml-value-expression is null.
UNKNOWN
When the evaluation of the specied query expression against the specied xml-value
returns a non-empty sequence of nodes or values.
TRUE
When evaluation of the specied query expression against the specied xml-value
returns an empty sequence.
FALSE
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.
vFabric SQLFire User's Guide574
vFabric SQLFire Reference