Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

CHAPTER 8 XML Query > Using XMLQuery() - Pg. 150

Chapter 8: XML Query 133 In this query, the for statement iterates the <contact> elements (assigned as the $cd variable) from the files stored in the /public/contact/xml folder in XML DB Repository. The where clause restricts to select <contact> elements with a non-empty <email> element. The <contact> elements are processed in the order of their <last_name> element content as specified by the order by statement. The let statement retrieves the text content of <first_name> and <last_name> and assigns them to query variables. These variables are used in the return statement to construct the XML result. In practice, you don't have to use all of the FLWOR clauses in XQuery. Using XMLQuery() In Oracle XML DB, XQuery expressions need to be evaluated by SQL/XML functions such as XMLQuery(): XMLQUERY (XQuery-expression [PASSING value-expression [AS identifier]] RETURNING CONTENT [NULL ON EMPTY] ) The XMLQuery() function has two required arguments, an XQuery expression and a RETURNING CONTENT statement. The value-expression is used in the PASSING expression to