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

From: Raghavendra <raghavendra(dot)rao(at)enterprisedb(dot)com>
To: saritha N <saritha(dot)0917(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to get UPDATEXML function in postgresql as it works in oracle
Date: 2013-07-30 06:21:35
Message-ID: CA+h6AhjGgcdNX2VDNKq0CbfJMYe5nbcj+ef94W5_7i8L3UA_Qw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 30, 2013 at 9:51 AM, saritha N <saritha(dot)0917(at)gmail(dot)com> wrote:

> Thanks for your reply Raghavendra,
>
>
Thanks for the update.
Request to mark postgresql group email while replying so it will help much
if other's have better idea as well if any correction in my test case.

> Whatever you have sent its very useful for me.I need to add one more node
> between the values,like
> <values>Infosys<place>Bangalore</place></values>
> How to add?
>
>
postgres=# update xdata set
xmlcode='<values>Infosys<place>Bangalore</place></values>' where
cast(xpath('//values/text()',xmlcode) as text[]) = '{Infosys}';
UPDATE 1

postgres=# select xmlparse(content xmlcode) from xdata ;
xmlparse
--------------------------------------------------
<values>Enterprisedb</values>
<values>Wipro</values>
<values>Infosys<place>Bangalore</place></values>
(3 rows)

Some of the xml related links:
http://www.postgresql.org/docs/9.2/static/functions-xml.html
http://wiki.postgresql.org/wiki/What's_new_in_PostgreSQL_9.2#Ensure_that_xpath.28.29_escapes_special_characters_in_string_values

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message raghu ram 2013-07-30 06:23:25 Re: Fwd: corrupted files
Previous Message Luca Ferrari 2013-07-30 06:12:27 Re: to know what columns are getting updated