To store intact XML documents in a table, you must create or alter a table so that it contains a column with an XML user-defined type (UDT). The table is known as an XML table, a table that contains XML documents. The table can be an altered table or a new table. When a table contains a column of XML type, you can enable the column for XML.
You can alter an existing table with a column of XML type using the administration wizard, or using the DB2 command shell.
SALES_DB
ORDER
XMLVARCHAR
Create or alter a table with a column of an XML type in the column clause of the CREATE TABLE or ALTER TABLE statement.
Example: In the sales application, you might want to store an XML-formatted line item order in a column called ORDER of an application table called SALES_TAB. This table also has the columns INVOICE_NUM and SALES_PERSON. Because it is a small order, you store it using the XMLVARCHAR type. The primary key is INVOICE_NUM. The following CREATE TABLE statement creates the table with a column of XML type:
CREATE TABLE sales_tab( invoice_num char(6) NOT NULL PRIMARY KEY, sales_person varchar(20), order XMLVarchar);