Example: Validating an XML Document - Advanced SQL Engine - Teradata Database

XML Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
amr1556233250442.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1140
lifecycle
previous
Product Category
Teradata Vantageā„¢

In this query, the ISSCHEMAVALID method is used to validate the XML document in the customer table using the schema stored in the schematab table.

SELECT customerID, customerXML.ISSCHEMAVALID(schematab.schemaContent, 'Customer', '')
FROM customer, schematab
WHERE schematab.schemaid = 'customerschema.xsd';

The result of the query is:

customerID  customerXML.ISSCHEMAVALID(schemaContent, 'Customer', '')
-----------  --------------------------------------------------------
          1                                                         1

The ISSCHEMAVALID method returned a value of 1 indicating that the XML document is valid based on the schema.