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

Teradata Vantage™ XML Data Type

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1140-162K

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<
...