Re: replace function in a query

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: replace function in a query
Дата
Msg-id AFCCBB403D7E7A4581E48F20AF3E5DB202CB2192@EXADV1.host.magwien.gv.at
обсуждение исходный текст
Ответ на replace function in a query  ("Harpreet Dhaliwal" <harpreet.dhaliwal01@gmail.com>)
Список pgsql-general
> I have to write a query that does the following.
>
> select column_x from tbl_xyz
> where column_y = 'abc def ghi'
>
> new line characters i.e. '\n' in column_y should be replaced
> with a space character i.e. ' ' in this query.
> Is there any replace function that when used in the query
> with colulmn_y would do it?

Are you looking for something like this?

test=> SELECT translate ('abc
test'> def
test'> ghi', E'\n', ' ');
  translate
-------------
 abc def ghi
(1 row)

"translate" is described on
http://www.postgresql.org/docs/current/static/functions-string.html

Yours,
Laurenz Albe

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

Предыдущее
От: novnov
Дата:
Сообщение: Re: Trigger function which inserts into table; values from lookup
Следующее
От: "William Leite Araújo"
Дата:
Сообщение: Re: Trigger function which inserts into table; values from lookup