From: | "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at> |
---|---|
To: | "Harpreet Dhaliwal *EXTERN*" <harpreet(dot)dhaliwal01(at)gmail(dot)com>, "Postgres General" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: replace function in a query |
Date: | 2007-05-21 14:50:35 |
Message-ID: | AFCCBB403D7E7A4581E48F20AF3E5DB202CB2192@EXADV1.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | William Leite Araújo | 2007-05-21 15:16:31 | Re: Trigger function which inserts into table; values from lookup |
Previous Message | novnov | 2007-05-21 14:42:50 | Re: Trigger function which inserts into table; values from lookup |