Reference one element : UPDATEXML « XML « Oracle PL / SQL






Reference one element

    

SQL> create table myTable of xmltype;

Table created.

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

1 row created.

SQL>
SQL> select * from myTable;



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

  <customer>
   <name>AAA</name>
    <telephone>123 555-1234</telephone>
  </cu

1 row selected.

SQL>
SQL> update myTable c
  2  set value(c) = updateXML(value(c), '/customer/telephone/text()','888 555-1234')
  3  where existsnode(value(c),'/customer/name = "Chris Smith"') = 1
  4  /

0 rows updated.

SQL>
SQL> drop table myTable;

Table dropped.

   
    
    
    
  








Related examples in the same category

1.UPDATEXML function supports multiple elements
2.Update xmltype type column
3.Use UPDATEXML function to update a portion of the doc
4.Use the UPDATEXML function to change element value