Example: Create Tables with XML Data Type Columns - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
ncd1596241368722.ditamap
dita:ditavalPath
hoy1596145193032.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

This example creates a table with an XML column that is non-LOB.

CREATE TABLE xmlTable1(id INTEGER,
                       xml1 XML(64000));

This example creates a table with the following types of XML columns: non-LOB, LOB, and LOB with a specified inline length.

CREATE TABLE xmlTable2(id INTEGER,
                       xml1 XML(100),
                       xml2 XML,
                       xml3 XML INLINE LENGTH 30000);

This example uses a different syntax to create the same structure as xmlTable2, that is, a table with the following types of XML columns: non-LOB, LOB, and LOB with a specified inline length.

CREATE TABLE xmlTable3(id INTEGER,
                       xml1 XML(100) INLINE LENGTH 100,
                    	  xml2 XML,
                       xml3 XML INLINE LENGTH 30000);

This example creates a table with the following types of XML columns: non-LOB and LOB with specified inline lengths. When the specified maximum length is equal to the inline length, the XML data type is a non-LOB type.

CREATE TABLE xmlTable4(id INTEGER,
                       xml1 XML(30000) INLINE LENGTH 30000,
                       xml2 XML INLINE LENGTH 100);

This example creates a table with an XML column that is an LOB with a specified inline length.

CREATE TABLE xmlTable5(id INTEGER,
                       xml1 XML(64000) INLINE LENGTH 100);