Use value function with single xmltype table : XMLTYPE « XML « Oracle PL/SQL Tutorial






SQL> create table myTable of xmltype;

Table created.

SQL>
SQL> insert into myTable values(XMLTYPE('
  2    <customer>
  3     <name>Chris</name>
  4      <telephone>123 555-1234</telephone>
  5    </customer>'))
  6  /

1 row created.

SQL>
SQL> select * from myTable;



SYS_NC_ROWINFO$
------------------------------------------------------

  <customer>
   <name>Chris</name>
    <telephone>123 555-1234</telephone>
  </

1 row selected.

SQL>
SQL> update myTable c
  2  set value(c) = updateXML(value(c), '/customer/name/text()','new value')
  3  /

1 row updated.

SQL>
SQL>
SQL> select extractvalue(value(c),'/customer/telephone')
  2  from myTable c
  3  where existsnode(value(c),'/customer/name = "Chris"') = 1
  4  /

no rows selected

SQL>
SQL> drop table myTable;

Table dropped.

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