Using Schemas | XML Data Type | Teradata Vantage - Using Schemas - 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ā„¢

The CREATESCHEMABASEDXML and ISSCHEMAVALID methods accept a schema as an argument. For XML schemas that are composed of a single schema document (the schema document does not include or import another schema document), you can pass the schema document as an XML type value to the method. For XML schemas that are made up of more than one document, you must pass the consolidated schema document as an XML type value to the method.

You can store the schema or consolidated schema document in a table and use it in a query that performs schema validation through a join as follows:

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

If you want to perform multiple validations per row, you can use subqueries of the following form:

SELECT x.xmlcol1.isschemavalid(s1.schemacontent, '', ''),
   x.xmlcol2.isschemavalid(s2.schemacontent, '', '')
FROM xmldata x,
   (select st.schemacontent
    from schematab st
    where st.schemaid = 'myFirstSchema.xsd') s1,
   (select st.schemacontent
    from schematab st
    where st.schemaid = 'mySecondSchema.xsd') s2;