Loading XML data into relational tables is needed when we receive XML data from other applications. The available approaches include using the XMLTable() function, creating SQL/XML or XQuery views instead of triggers, using DBMS_XMLSTORE, and using the Oracle XDK Java XSU oracle.xml.sql.dml.OracleXMLSave package. Among these approaches, using XMLTable() is the easiest approach and thus is the method we will discuss now.
To load XML data into relational tables with XMLTable(), you need to insert XML from the relational view created by XMLTable(). For example, the following table stores email templates (loading_xml.sql):
Listing 9-9 Inserting Data to Relational Table Using XMLTable() View
CREATE TABLE email_template_tbl ...