Examples | Using XQuery/XPath Query | Teradata Vantage - 17.10 - Example: XQuery/XPath Query Returns the First Customer Child - 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 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">