Skip Headers
Oracle® Database SQL Reference
10g Release 2 (10.2)

Part Number B14200-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

XMLTABLE

Syntax

Description of XMLTable.gif follows
Description of the illustration XMLTable.gif

XML_namespaces_clause::=

Description of XML_namespaces_clause.gif follows
Description of the illustration XML_namespaces_clause.gif

XMLTABLE_options::=

Description of XMLTABLE_options.gif follows
Description of the illustration XMLTABLE_options.gif

XML_passing_clause::=

Description of XML_passing_clause.gif follows
Description of the illustration XML_passing_clause.gif

XML_table_column::=

Description of XML_table_column.gif follows
Description of the illustration XML_table_column.gif

Purpose

XMLTable maps the result of an XQuery evaluation into relational rows and columns. You can query the result returned by the function as a virtual relational table using SQL.

See Also:

Oracle XML DB Developer's Guide for more information on the XMLTable function, including additional examples, and on XQuery in general

Examples

The following example converts the result of applying the XQuery '/Warehouse' to each value in the warehouse_spec column of the warehouses table into a virtual relational table with columns Water and Rail:

SELECT warehouse_name warehouse,
   warehouse2."Water", warehouse2."Rail"
   FROM warehouses,
   XMLTABLE('/Warehouse'
      PASSING warehouses.warehouse_spec
      COLUMNS 
         "Water" varchar2(6) PATH '/Warehouse/WaterAccess',
         "Rail" varchar2(6) PATH '/Warehouse/RailAccess') 
      warehouse2;

WAREHOUSE                           Water  Rail
----------------------------------- ------ ------
Southlake, Texas                    Y      N
San Francisco                       Y      N
New Jersey                          N      N
Seattle, Washington                 N      Y