Using ora:contains()

The simplest XML full-text search is to use ora:contains() in the XMLExists() SQL function. Let’s search the purchase orders from the po_mv view (query_oracontains.sql):

Listing 10-1 Full-Text XML Query Using ora:contains()

select XMLQuery(‘/PurchaseOrder/@id’

passing purchase_order returning content)

from po_mv

where XMLExists(‘/PurchaseOrder/Customer/Name[ora:contains(text(),liu)>0]’ passing by value purchase_order);

When executing the query, Oracle XML DB will retrieve all of the data first, perform full-text analysis at run-time, and then deliver matched search results.

Get Oracle Database 11g Building Oracle XML DB Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.