Re: Escape variable

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Jaime Rivera <jriverarojas(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Escape variable
Date: 2016-10-27 17:33:36
Message-ID: e368757d-e167-cf15-3716-f6da11e3b69b@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/27/2016 08:57 AM, Jaime Rivera wrote:
> Hello,
>
> I've been looking for a way to escape a variable inside a plpgsql stored
> procedure just like E works with constants.
>
> For example :
>
> * select E'Se recibi\u00f3 a \n ci\u00f3n.' *
>
> Returns:
>
> /*Se recibió a */
> /* ción.*/

Something like?:

DO $$
DECLARE
esc_str varchar;
BEGIN
esc_str = E'Se recibi\u00f3 a \n ci\u00f3n.' ;
RAISE NOTICE '%', esc_str;
END;
$$ LANGUAGE plpgsql;

NOTICE: Se recibió a
ción.
DO

If not then can you show an example from in plpgsql?

>
> Thanks
>
> Jaime
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2016-10-27 17:45:45 Re: libpq heartbeat
Previous Message Merlin Moncure 2016-10-27 17:29:17 Re: libpq heartbeat