Learn XQuery |
Home:Learn XQuery:XQuery Tutorial:Querying XML Columns :Evaluating XML in Memory Evaluating XML in MemoryDataDirect XQuery® supports an extension expression named evaluate in memory that forces an expression to be evaluated in memory using XQuery directly, not using SQL. This is a simple way to use XQuery functionality that is not available in SQL. For example, the following query fails and raises an error because DataDirect XQuery® cannot evaluate path expressions against XML in the database: for $h in collection('HOLDINGSXML')/HOLDINGSXML
where $h/USERID eq 'Minollo'
return
$h/HOLDINGS[@COMPANY = 'Progress Software']
If we rewrite the query, using the evaluate-in-memory extension expression to force the XML to be evaluated in memory, the query succeeds: for $h in collection('HOLDINGSXML')/HOLDINGSXML
let $holdings := (# ddtek:evaluate-in-memory #) {$h/XMLCOL)
where $h/USERID eq 'Minollo'
return
$holdings/SHARE[xs:string(@COMPANY) eq 'Progress
Software']
The result looks like this: <HOLDINGS>
<SHARE COMPANY="Progress Software"
USERID="Minollo">4000000</SHARE>
</HOLDINGS>
|
Try DataDirect XQuery® Free!Put the power, scalability, and performance of DataDirect XQuery® to work for you today! Our free trial lets you see for yourself how easy it is to build data integration applications that access relational, EDI, and other file formats as XML! Stay Informed!XQuery is one of the hottest XML technologies being developed today. Stay informed with vital news about standards, tools, and trends by signing up for the DataDirect XQuery® newsletter. |





