Re: how to get UPDATEXML function in postgresql as it works in oracle - Mailing list pgsql-general

From Raghavendra
Subject Re: how to get UPDATEXML function in postgresql as it works in oracle
Date
Msg-id CA+h6AhjAMyKGCSd8WFYOwW8vsWiMe_xZXLDw3M2ukp62FNV5NQ@mail.gmail.com
Whole thread Raw
In response to how to get UPDATEXML function in postgresql as it works in oracle  (saritha N <saritha.0917@gmail.com>)
List pgsql-general
On Mon, Jul 29, 2013 at 7:14 PM, saritha N <saritha.0917@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


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: 5 is not a smallint but '5' is
Next
From: Tim Spencer
Date:
Subject: Re: how _not_ to log?