Search Postgresql Archives

Re: how to get UPDATEXML function in postgresql as it works in oracle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 29, 2013 at 7:14 PM, saritha N <saritha.0917@xxxxxxxxx> 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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux