Skip Headers
Oracle® Database SQL Language Reference
11g Release 2 (11.2)

E41084-03
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

XMLnamespaces_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