Re: cast hex to int in plpgsql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Janek Sendrowski <janek12(at)web(dot)de>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: cast hex to int in plpgsql
Date: 2013-12-31 22:35:23
Message-ID: CAFj8pRD_iWbaVed5Yw+F5BDW8BPsyHHXajfJFtkGG4c+Y+fpHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

this transformation is implemented inside parser - so you can not use a
parameters there. You can use a dynamic SQL trick

http://postgres.cz/wiki/PostgreSQL_SQL_Tricks_II#Conversion_between_hex_and_dec_numbers

Regards

Pavel

2013/12/31 Janek Sendrowski <janek12(at)web(dot)de>

> Hi,
>
> How can I realize the line?
> v_res := cast(x'v_tmp' as bigint);
>
> v_tmp is a text variable with hex digits.
>
> this works:
> v_res := cast(x'6de14a8b478ac' as bigint);
>
> I think its about quoting
>
> Janek
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2013-12-31 22:41:02 Re: Format of Pioint datatype.... lat/long or long/lat??
Previous Message Adrian Klaver 2013-12-31 22:34:24 Re: Format of Pioint datatype.... lat/long or long/lat??