Re: replace single char for string using regexp_replace

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: PegoraroF10 <marcos(at)f10(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: replace single char for string using regexp_replace
Date: 2019-12-30 04:50:03
Message-ID: 4204.1577681403@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

PegoraroF10 <marcos(at)f10(dot)com(dot)br> writes:
> I have to replace ; , " and ' chars in an string putting its correspondent
> ascii value
> I have a
> Replace(Replace(Replace(Replace($$Text,with;On'It"$$,',','chr(59)'),';','chr(44)'),'"','chr(34)'),'''','chr(39)')
> It works but I would like to call just one Replace.

Use translate(), perhaps?

https://www.postgresql.org/docs/current/functions-string.html

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Apitz 2019-12-30 07:04:35 Re: testing in ESQL/C if a CUSROR "foo" is open?
Previous Message PegoraroF10 2019-12-30 00:00:59 replace single char for string using regexp_replace