pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fernando Grijalba <fgrijalba@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Convert int to hex
Date: Thu, 2 Jun 2005 06:04:34 -0400
Message-ID: <f817a44d050602030451270b0f@mail.gmail.com> (raw)
In-Reply-To: <6d8daee305060114074a9631e@mail.gmail.com>
References: <f817a44d050601134211d78731@mail.gmail.com>
	<6d8daee305060114074a9631e@mail.gmail.com>

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@gmail.com> wrote:
> On 6/1/05, Fernando Grijalba <fgrijalba@gmail.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)
>



view thread (4+ messages)

Message-ID: <f817a44d050602030451270b0f@mail.gmail.com>
Permalink:  ../f817a44d050602030451270b0f@mail.gmail.com/
Also on:    postgresql.org/message-id/f817a44d050602030451270b0f@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: fgrijalba@gmail.com
  Subject: Re: Convert int to hex
  In-Reply-To: <f817a44d050602030451270b0f@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox