Re: How to remove a set of characters in text-columns ?

Поиск
Список
Период
Сортировка
От Tim Landscheidt
Тема Re: How to remove a set of characters in text-columns ?
Дата
Msg-id m37h82lp64.fsf@passepartout.tim-landscheidt.de
обсуждение исходный текст
Ответ на How to remove a set of characters in text-columns ?  (Andreas <maps.on@gmx.net>)
Ответы Re: How to remove a set of characters in text-columns ?
Список pgsql-sql
(anonymous) wrote:

> how can I remove a set of characters in text-columns ?
> Say I'd like to remove { } ( ) ' " , ; . : !
> Of course I can chain replace ( replace ( replace ( replace
> ( ... , '' ) .... and replace the chars one by one against
> an empty string ''.

> There might be a more elegant way.
> Is there ?

Besides the regexp_replace() solution mentioned by Charlie
and Steve, you can also use TRANSLATE():

| tim=# SELECT TRANSLATE('a{b''c"d!f', '{}()''",;.:!', '');
|  translate
| -----------
|  abcdf
| (1 Zeile)

| tim=#

Tim



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

Предыдущее
От: Charlie
Дата:
Сообщение: Re: [SQL] How to remove a set of characters in text-columns ?
Следующее
От: Andreas
Дата:
Сообщение: Re: How to remove a set of characters in text-columns ?