6.5. Building XML Documents from Relational Data

Oracle's version 9i provides several new SQL functions and PL/SQL packages that can be used to handle XML documents. The SQL functions process XMLType objects—for example, to ask for the existence of certain nodes, to extract fragments, or to create XMLType objects by using SQL queries and table data.

6.5.1. SQL Functions existsNode and extract

Two built-in SQL functions extract and existsNode handle XMLType objects in SQL statements. They behave similar to the methods of XMLType of the same name even if the signature is slightly different; the result is again an XMLType object. Both methods are directly usable in SQL statements, as shown in Listing 6.20.

Listing 6.20. extract and existsNode Example ...

Get XML Data Management: Native XML and XML-Enabled Database Systems 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.