16.20 - Example: Using XMLTABLE Without the COLUMNS Clause - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ XML Data Type

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Release Date
March 2019
Content Type
Programming Reference
Publication ID
B035-1140-162K
Language
English (United States)

If you omit the COLUMNS clause, the items returned by the 'XML_tab_row_pattern' query are returned as a column of XML data type.

SELECT X.*
FROM (SELECT * FROM customer WHERE customerID = 1) AS C,
   XMLTable (
      '/Customer/Order/Item'
      PASSING C.customerXML
   ) AS X ("ItemXML");

Here are partial results from the query. The ellipsis (...) is not part of the query results. It indicates that the query returns additional results that are truncated in the example.

ItemXML
-----------------------------------------------------------------------
<Item ID="001"> <Quantity>10</Quantity> <PartNumber>F54709</
PartNumber> <Description>Motorola S10-HD Bluetooth Stereo
Headphones</Description> <UnitPrice>29.50</UnitPrice> <Price
<Item ID="101"> <Quantity>1</Quantity> <PartNumber>Z19743</
PartNumber> <Description>Motorola Milestone XT800 Cell Phone</
Description> <UnitPrice>139.99</UnitPrice> <Price>139.99<
...