Creating XML Types

An XMLType can be a relational table column, an XMLType object table, a PL/SQL parameter, or a document resource in XML DB Repository. Let’s learn about each of them through examples. A detailed discussion of creating XML DB Repository resources will be provided in Chapter 3.

The following example creates a relational table with an XMLType column (create_xmltype_ col.sql):

Listing 2-1 Creating an XMLType Column

CREATE TABLE contact_tbl (id NUMBER, content XMLType)

XMLTYPE COLUMN “CONTENT” STORE AS BINARY XML;

The XMLTYPE COLUMN “CONTENT” STORE AS BINARY XML option specifies the binary XMLType format. We can check the table definition using the following command:

SQL> desc contact_tbl;

Name Null? Type
--------------- ...

Get Oracle Database 11g Building Oracle XML DB Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.