17.10 - Example: XQuery/XPath Query Returns a Sequence of Customer Elements - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - XML Data Type

Advanced SQL Engine
Teradata Database
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)
The following query returns a sequence of customer elements:
SELECT CAST(xmldoc.xmlextract('/customers/customer', NULL) AS VARCHAR(1024))
AS customerlist
FROM xmltab;
The return value for this query is of VARCHAR type containing the following string (serialization of a sequence is the serialization of the items of the sequence separated by a single white space character):
   <Name>John Hancock</Name>
   <Address>100 1st Street One City, CA 12345</Address>
   <order Number="NW-01-16366" Date="Feb/28/2001">
      <Contact>Mary Shannon</Contact>
      <ShipTo>Widgets Inc., 123 Regency Parkway, Portland, OR 43211</ShipTo>
      <item ID="001">
   <Name>Jim Smith</Name>
   <Address>200 2nd Street, San Diego, CA 12345</Address>
   <order Number="JS-01-16366" Date="Feb/29/2001">
      <Contact>Jim Smith</Contact>
      <ShipTo>Acme co., 2467 Pioneer Road, San Diego, CA 12345</ShipTo>
      <item ID="001">