Re: Convert int to hex

From: Fernando Grijalba <fgrijalba(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Convert int to hex
Date: 2005-06-02 10:04:34
Message-ID: f817a44d050602030451270b0f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thank you, I found out after I posted the message.

I did read the docs but must have looked somewhere else and I search
the lists for hex only and it did not bring the answer back. It
wasn't until I search for int4 to hex that I was able to find the
answer.

Thank you again.

Fernando

On 6/1/05, Tony Wasson <ajwasson(at)gmail(dot)com> wrote:
> On 6/1/05, Fernando Grijalba <fgrijalba(at)gmail(dot)com> wrote:
> > I want to be able to change an int4 from a sequence and store it as
> > varchar in the database as a hex number.
> >
> > Is this possible?
> >
> > Thank you,
> >
> > Fernando
>
> Sure you can go from integer to hex and back...
> http://www.varlena.com/varlena/GeneralBits/104.php
>
> Here's the example queries to get you started.
>
> =# select to_hex(11);
> to_hex
> --------
> b
> (1 row)
>
> =# select x'ab'::integer;
> int4
> ------
> 171
> (1 row)
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-06-02 10:12:36 Re: [SQL] index row size 2728 exceeds btree maximum, 2713
Previous Message Richard Huxton 2005-06-02 09:58:49 Re: index row size 2728 exceeds btree maximum, 2713