Example: Using XMLVALIDATE to Validate XML Values - Analytics Database - Teradata Vantage

XML Data Type

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-10-30
dita:mapPath
tkc1628112506748.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
dgs1472251600184
lifecycle
latest
Product Category
Teradata Vantageā„¢

This query validates the XML values in the customerXML column of the customer table using the schema in the schemacontent column of the schematab table for the row where the schemaid column has the value 'customerschema.xsd'. The resulting column are copies of the XML values with type annotations.

SELECT XMLVALIDATE(DOCUMENT customer.customerXML ACCORDING TO XMLSCHEMA VALUE schematab.schemacontent)
FROM customer, schematab
WHERE schematab.schemaid = 'customerschema.xsd';

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.

XMLVALIDATE(DOCUMENT customerXML ACCORDING TO XMLSCHEMA VALUE...
----------------------------------------------------------------
<Customer>  <Name>John Hancock</Name>  <Address>100 1st Street, San Francisco, CA 94118</Address>  <Phone1>(858)555-1234</Phone1>  <Phone2>(858)555-9876</Phone2>  <Fax>(858)555-9999</Fax>  <Email>John...