Re: Help with converting hexadecimal to decimal

Поиск
Список
Период
Сортировка
От Doug Quale
Тема Re: Help with converting hexadecimal to decimal
Дата
Msg-id 87sm2bqizf.fsf@charter.net
обсуждение исходный текст
Ответ на Re: Help with converting hexadecimal to decimal  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Help with converting hexadecimal to decimal  (Dawid Kuroczko <qnex42@gmail.com>)
Список pgsql-general
Bruce Momjian <pgman@candle.pha.pa.us> writes:

> Chandra Sekhar Surapaneni wrote:
> > Hi All,
> >   Is there a built in function which works exactly the opposite way as
> > to_hex().
> > I basically want to convert a a hexadecimal to a decimal.
>
> Sure:
>
>     test=> SELECT x'10'::integer;
>      int4
>     ------
>        16
>     (1 row)

That's not the inverse of to_hex().  to_hex() takes an integer and
returns text.  You've taken the bitstring constant B'10000' and
coerced it to integer.  The inverse funtion would take the text '10'
and return the integer 16.

В списке pgsql-general по дате отправления:

Предыдущее
От: Glen Eustace
Дата:
Сообщение: Inconsistent values for 'now'
Следующее
От: "Zitan Broth"
Дата:
Сообщение: SELECT INTO Array?