Hi All,
I'm using SQL*Plus in Oracle 11g.
I've been doing some experiments with executing xqueries. So far, I've used the form "select xmlquery('<statement>') from dual;", but this is annoying because some character escaping has to be done: the xquery must use only double quotes, not single, and function declarations must be terminated by
};(: :)
instead of the standard };
Using "xquery"instead of "xmlquery" gets rid of these problems. For example:
xquery
declare function local:one() { 1 };
local:one()
/
works as expected. So that's better. But so far I've been unable to use passing clauses, either to set the context or external variables, with xquery:
xquery
1
passing XMLTYPE('<dummy/>')
/
returns:
ERROR:
ORA-19114: XPST0003 - error during parsing the XQuery expression:
LPX-00801: XQuery syntax error at 'passing'
So I have a couple of questions:
* How can I use 'passing' to set the context in xquery?
* How can I use 'passing' to set external variables in xquery?
* Is there a way to use xquery or xmlquery with the query being in a file on the (client's or server's) filesystem, and having this file containing any legal xquery -- with single-quotes, double-quotes, and unescaped function declaration endings?
* What is your personal guideline in choosing between xquery and xmlquery?
Thanks!