16.20 - Example: XQuery/XPath Query Returns the First Customer Child - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantageā„¢ XML Data Type

Teradata Database
Teradata Vantage NewSQL Engine
Release Number
Release Date
March 2019
Content Type
Programming Reference
Publication ID
English (United States)
The following query returns the first customer child of the customers document element:
SELECT xmldoc.xmlextract('/customers/customer[1]', NULL)
AS firstcustomer
FROM xmltab;
The following shows the wire-format of the XML value that is the result of this query. The single element node when serialized is a well-formed XML document.
   <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">