5 Replies Latest reply on Sep 23, 2019 8:02 AM by heloo

    about standard update xmltype data in oracle 12c

    heloo

      i am using oracle 12c, how can i update the following xmltype data by sql script using sqlplus. i would like to update value "555" to "888" in the table.

       

       

       

       

      CREATE TABLE TEMP1

      (

         ID varchar2(255) PRIMARY KEY NOT NULL,

         XMLCOL XMLTYPE

      );

       

      My xmlcol data as below:

      ------------------------------------------------------------

      <row id='1'><a4 m='86'>852</a4>

      <a4 m='86' s='2'>852</a4>
      <a4 m='87'>555</a4><a4 m='87' s='2'>666</a4>
      <a4 m='88'>55555</a4><a4 m='88' s='2'>66666</a4>
      <a4 m='89'>999</a4><a4 m='89' s='2'>999</a4>
      <a4 m='86'>852</a4><a4 m='86' s='3'>852</a4>
      <a4 m='87'>555</a4><a4 m='87' s='3'>333</a4>
      <a4 m='88'>55555</a4><a4 m='88' s='3'>33333</a4>
      <a4 m='89'>999</a4><a4 m='89' s='3'>999</a4>
      </row>

       

      --------

      CAN I use the following script.

       

      UPDATE TEMP1

      SET XMLCOL = XMLTYPE(

      REPLACE(

      XMLTYPE.GetClobVal(XMLCOL),

      '555','888'

      )

      )