Using XPath queries to XML views
XP-V-3 Examples
Using XPATH in SQL Queries and Procedures.
Example
An XPATH expression can appear as a SQL query expression, that is, as a derived table or subquery predicate or scalar subquery. This means that the XPATH expression is expanded compile time to the corresponding SQL.
The query
select * from (XPATH '[__* __view "DB"."DBA"."cat"]//product/@ProductName') P order by P."ProductName"
will evaluate the //product query in the context of the 'cat' XML view and produce a result set consisting of the ordered 'ProductName' attributes of the product entity as defined in the view:
ProductName VARCHAR _______________________________________________________________________________ Alice Mutton Aniseed Syrup Boston Crab Meat Camembert Pierrot Carnarvon Tigers Chai Chang Chartreuse verte . . . . . . Zaanse koeken
OpenLink Home
Technical Support