On Mon, Jul 29, 2013 at 7:14 PM, saritha N <saritha.0...@gmail.com> wrote:

> Hi,
>
> I am new to postgresql.We are migrating our application from oracle to
> postgresql.We are using postgresql version  9.2.All most everything we are
> migrated but I am unable to write a function for UPDATEXML which works same
> as in oracle.Please help me  to resolve .
>
> Are you looking in this way....

create table xdata(id int,xmlcode xml);
insert into xdata values (1,'<values>Infosys</values>');
insert into xdata values (1,'<values>Enterprisedb</values>');
insert into xdata values (1,'<values>Wipro</values>');

postgres=# select * from xdata ;
 id |            xmlcode
----+-------------------------------
  1 | <values>Infosys</values>
  1 | <values>Enterprisedb</values>
  1 | <values>Wipro</values>
(3 rows)

postgres=# update xdata set xmlcode='<values>Infosys-Bangalore</values>'
where cast(xpath('//values/text()',xmlcode) as text[]) = '{Infosys}';
UPDATE 1
postgres=# select * from xdata ;
 id |              xmlcode
----+------------------------------------
  1 | <values>Enterprisedb</values>
  1 | <values>Wipro</values>
  1 | <values>Infosys-Bangalore</values>
(3 rows)


---
Regards,
Raghavendra
EnterpriseDB Corporation
Blog: http://raghavt.blogspot.com/

Reply via email to