Creating XML from Relational Tables

Figure 9-1 shows an Entity-Relationship (ER) map of a set of relational tables storing purchase orders.

The seven tables include ORDER_TBL, ORDER_ITEM_TBL, CUSTOMER_TBL, PRODUCT_TBL, SUPPLIER_TBL, ACCOUNT_MGR_TBL, and COUNTRY_TBL tables (po_create_tables.sql) to store customers, sales, and order information (data inserted with po_insert_data.sql). Let’s use these tables to learn how to create XML from relational tables.

Using SQL/XML Functions

SQL/XML functions can be used to create XML document. Table 9-1 lists the SQL/XML functions in Oracle Database 11g.

Image

FIGURE 9-1. Purchase Order database Entity-Relationship ...

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.