Re: using replace function

Поиск
Список
Период
Сортировка
От Rob Sargent
Тема Re: using replace function
Дата
Msg-id E7D20D52-5606-4D78-8CD8-77BB17DB62AA@gmail.com
обсуждение исходный текст
Ответ на using replace function  (Antonio Silva <aolinto.lst@gmail.com>)
Ответы Re: using replace function
Список pgsql-general

> On Nov 28, 2019, at 1:09 PM, Antonio Silva <aolinto.lst@gmail.com> wrote:
>
> Hello list
>
> I want to replace a string (not a substring) in a field but making sure that the string in the full field.
>
> In the example below since 'blue' is not the full text in 'blue shark' there should not have a replacement.
>
> How to say "replace only with 'blue' if it is the full string in the field".
>
> With REPLACE I get:
>
> SELECT REPLACE('blue shark','blue','blue fish');
>      replace
> -----------------
>  blue fish shark
> (1 row)
>
> but I would like to get:
>
> SELECT REPLACE('blue shark','blue','blue fish');
>   replace
> ------------
>  blue shark
> (1 row)
>
> Thanks a lot
>
> Antonio Olinto

does this help?
select replace (a.col, ‘value’, ’new value’) where a.col = ‘value’;




В списке pgsql-general по дате отправления:

Предыдущее
От: Antonio Silva
Дата:
Сообщение: using replace function
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: using replace function