PL/SQL (MOSC)

MOSC Banner

How update xml data with nvarchar2 values

I have following table

Create table tb_test

(myid   number, Xmlstring nclob);


I insert the following record into the table 

insert into tb_test (myid, Xmlstring) values (1,

n'<Permits> 

  <BPermit>

    <Signature>

     <Labels ID="WorkDocPermitsSignature">

       <Label Lang="de">deą-Naam en Handt. operat. manag.</Label>

     </Labels>

     <Name>

       <Field/>

     </Name>

    </Signature>

  </BPermit>

 </Permits>');


Note: the speciaal char ą = nchr(462) in the table.

Then I want to update the signature in de xmlstring-field

I use following stmt

declare 

 vReplace   varchar2(50) := '/Permits/BPermit/Signature/Name';

 inXMLSTRING  varchar2(50) := '<Name><Field>Here comes my Name></Field></Name>';


begin

 update tb_test

  set xmlstring = updatexml(xmltype(xmlstring),vReplace,inXMLSTRING).getClobVal()

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center