Example: Storing a Schema in a Table - 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™

After defining a schema, you can store it in a table before using it for validating XML values. In this example, the schema document is stored in the table schematab, which is defined as the following:

CREATE TABLE schematab (
   schemaid VARCHAR(32),
   schemaContent XML )
   PRIMARY INDEX (schemaid);

The schema.txt file used in the .IMPORT statement below has the following format:

customerschema.xsd|customerschema.xsd

Use this statement to store the schema in the schematab table:

.IMPORT VARTEXT '|' LOBCOLS=1 FILE=schema.txt
USING (fxsd XML AS DEFERRED, xmlid varchar(32))
INSERT into schematab values(:xmlid, :fxsd);