The XMLTYPE data type is used to store XML data.

The advantage over storing XML data in a character field is that it checks whether the input values are well-formed, and there are support functions to perform type-safe operations.

As defined by the XML standard, the XML type can store well-formed documents and content fragments, which are defined by the production XMLDecl? Content in the XML standard. This means that content fragments can have more than one top-level element or character node.

Note Oracle does not support the storage of content fragments in XMLTYPE columns.


The following example shows the creation and insertion of a row into a table with an XMLTYPE column.

    content         XMLTYPE

INSERT INTO books VALUES (XMLPARSE (DOCUMENT '<? xml version="1.0"? ><book><title>Manual</title><chapter>...</chapter></book>'));

SELECT * FROM books;

(1 row)