Update xmltype type column : UPDATEXML « XML « Oracle PL/SQL Tutorial






SQL> create table myTable of xmltype;

Table created.

SQL>
SQL> insert into myTable values(XMLTYPE('
  2    <customer>
  3     <name>name value</name>
  4    </customer>'))
  5  /

1 row created.

SQL>
SQL> select * from myTable;



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

  <customer>
   <name>name value</name>
  </customer>

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> drop table myTable;

Table dropped.

SQL>








33.8.UPDATEXML
33.8.1.UPDATEXML function supports multiple elements
33.8.2.Update (i.e. replace) the entire XMLType column with new content
33.8.3.Update xmltype type column
33.8.4.Use UPDATEXML function to update a portion of the doc
33.8.5.Use the UPDATEXML function to change element value