To create tables with XML columns, you specify columns with the XML data type in the CREATE TABLE statement. A table can have one or more XML columns.
You do not specify a length when you define an XML column. However, serialized XML data that is exchanged with a DB2® database is limited to 2 GB per value of type XML, so the effective limit of an XML document is 2 GB.
Like a LOB column, an XML column holds only a descriptor of the column. The data is stored separately.
CREATE TABLE Customer (Cid BIGINT NOT NULL PRIMARY KEY,
Info XML,
History XML)
CREATE TABLE TableValid (id BIGINT,
xmlcol XML,
CONSTRAINT valid_check CHECK (xmlcol IS VALIDATED))
CREATE TABLE TableXmlCol (id BIGINT,
xmlcol XML) COMPRESS YES
CREATE TABLE Patients ( patientID BIGINT, visit_date DATE, diagInfo XML,
prescription XML )
INDEX IN indexTbsp LONG IN ltbsp
PARTITION BY ( visit_date )
( STARTING '1/1/2000' ENDING '12/31/2006',
STARTING '1/1/2007' ENDING '6/30/2007',
ENDING '12/31/2007',
ENDING '6/30/2008',
ENDING '12/31/2008',
ENDING '6/30/2009' );