Обсуждение: Display integer value as Hex.

Поиск
Список
Период
Сортировка

Display integer value as Hex.

От
HK
Дата:
Hi all,
   Is there any function available in pgsql to display an integer value as
a hex value and vice versa.

TIA.
--
regards,
hari
      __
     / /    __  _  _  _  _ __  __         -o)
    / /__  / / / \\// //_// \\ \\/ /         /\\\\  Making things happen
   /____/ /_/ /_/\\/ /___/  /_/\\_\\        _\\_v-

-------------------------------------------------------------------


Re: Display integer value as Hex.

От
Joe Conway
Дата:
HK wrote:
>    Is there any function available in pgsql to display an integer value as
> a hex value and vice versa.
>

This works in 7.3, but not earlier:

test=# select to_hex(15678);
  to_hex
--------
  3d3e
(1 row)

This might also work in 7.2, but I'm not too sure, and I don't have a
7.2.x installation to test with:

test=# select x'3d3e'::int;
  int4
-------
  15678
(1 row)

HTH,

Joe