Thread: hexdecimal constant in postgresql

hexdecimal constant in postgresql

From
Chris
Date:
hello,

i was wondering how to specify hexadecimal constants in
SQL in a way that postgresql understands.

something like:

select 0xFFFF;   -- this doesn't work;

I've googled for it and i've found it can be done with
encode/decode involving a bytea type - but i'm under
the impression there must be a more straightforward way...

Bye, Chris.



Re: hexdecimal constant in postgresql

From
Chris
Date:
> i was wondering how to specify hexadecimal constants in
> SQL in a way that postgresql understands.
>
> something like:
>
> select 0xFFFF;   -- this doesn't work;
>
> I've googled for it and i've found it can be done with
> encode/decode involving a bytea type - but i'm under
> the impression there must be a more straightforward way...

I've found it myself :)

  select x'FFFF'::int;     -- this works

Bye, Chris.