Insert xml document to a XMLType column with xmltype function : XMLTYPE « XML « Oracle PL/SQL Tutorial






SQL> CREATE TABLE myTable(
  2      id  NUMBER PRIMARY KEY,
  3      emps XMLType NOT NULL
  4  );

Table created.

SQL>
SQL> INSERT INTO myTable VALUES (1, xmltype('<?xml version="1.0" standalone="no"
 ?>
  2  <emps>
  3      <emp>
  4          <home_address>address 1</home_address>
  5      </emp>
  6  </emps>')
  7  );

1 row created.

SQL>
SQL>
SQL> select extract(emps, '/emps/emp/home_address/text()' )
  2  from myTable
  3  /



EXTRACT(EMPS,'/EMPS/EMP/HOME_ADDRESS/TEXT()')
------------------------------------------------------
address 1

1 row selected.

SQL>
SQL>
SQL> drop table myTable;

Table dropped.

SQL>
SQL>
SQL>








33.4.XMLTYPE
33.4.1.XMLTYPE column
33.4.2.Use sys.xmltype.createxml to add XML data to table
33.4.3.Retrieve value from SYS.XMLTYPE column
33.4.4.Individual fields from the XMLTYPE'd column may be found using the EXTRACTVALUE function like this:
33.4.5.Creation of tables using XMLType data type and set the xml schema
33.4.6.Insert xml document to a XMLType column with xmltype function
33.4.7.PL/SQL ability to access text within an XML document in the database
33.4.8.Query xmltype column
33.4.9.Store an XMLType type data in clob
33.4.10.Use value function with single xmltype table
33.4.11.Use xmltype to convert xml string to xmltype data