From: Tom Lane <tgl@sss.pgh.pa.us>
To: PegoraroF10 <marcos@f10.com.br>
Cc: pgsql-general@postgresql.org
Subject: Re: replace single char for string using regexp_replace
Date: Sun, 29 Dec 2019 23:50:03 -0500
Message-ID: <4204.1577681403@sss.pgh.pa.us> (raw)
In-Reply-To: <1577664059509-0.post@n3.nabble.com>
References: <1577664059509-0.post@n3.nabble.com>
PegoraroF10 <marcos@f10.com.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, marcos@f10.com.br
Subject: Re: replace single char for string using regexp_replace
In-Reply-To: <4204.1577681403@sss.pgh.pa.us>
References: <1577664059509-0.post@n3.nabble.com> <4204.1577681403@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox