Re: hex to decimal and back again

From: Joe Conway <mail(at)joeconway(dot)com>
To: listuser(at)peternixon(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: hex to decimal and back again
Date: 2003-04-01 18:48:19
Message-ID: 3E89DEF3.8070400@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Peter Nixon wrote:
> I have some hex values which I am currently storing in varchar fields which
> I would like to convert to decimal integers to make sorting and indexing
> work correctly. I may need to convert them back to hex at some point for
> display but this is not strictly necessary. I can seem to find the right
> function to do this in postgres.
>

Is this what you need?

regression=# select x'ffff'::int4;
int4
-------
65535
(1 row)

HTH,

Joe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Lu 2003-04-01 18:59:27 error: lost syncronization with server
Previous Message Joe Conway 2003-04-01 18:46:26 Re: create type problem!