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

Поиск
Список
Период
Сортировка
От Raghavendra
Тема Re: how to get UPDATEXML function in postgresql as it works in oracle
Дата
Msg-id CA+h6AhjAMyKGCSd8WFYOwW8vsWiMe_xZXLDw3M2ukp62FNV5NQ@mail.gmail.com
обсуждение исходный текст
Ответ на how to get UPDATEXML function in postgresql as it works in oracle  (saritha N <saritha.0917@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 5 is not a smallint but '5' is
Следующее
От: Tim Spencer
Дата:
Сообщение: Re: how _not_ to log?