XMLTABLE

Syntax

Description of the illustration xmltable.gif

XMLnamespaces_clause::=

Description of the illustration xmlnamespaces_clause.gif

Note: You can specify at most one DEFAULT string clause.

XMLTABLE_options::=

Description of the illustration xmltable_options.gif

XML_passing_clause::=

Description of the illustration xml_passing_clause.gif

XML_table_column::=

Description of the illustration xml_table_column.gif

(datatype::=)

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.

XMLTable(... COLUMNS xyz)
is equivalent to
XMLTable(... COLUMNS xyz PATH 'XYZ')
You can use different `PATH` clauses to split the XQuery result into different virtual-table columns.

See Also:

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 'WaterAccess',
         "Rail" varchar2(6) PATH 'RailAccess')
      warehouse2;

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