X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 91FD152816 for ; Thu, 2 Jun 2005 07:04:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32796-02 for ; Thu, 2 Jun 2005 10:04:42 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) by svr1.postgresql.org (Postfix) with ESMTP id 901AE528D5 for ; Thu, 2 Jun 2005 07:04:41 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so238159wra for ; Thu, 02 Jun 2005 03:04:34 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=qgjE4AkA+CPER/RGIGDxs0eJc0j0olRAsdiBOA1x8uHGP0Z+G9jcbrf+A7K65kDayJeIkGqJRVpOo2AMqSsVeYP85K2vCrRNoDE/Zuywidoa2QY0mcY0w13hUW0P0vlxfLgxTpSr3ryrPpXMItQhch0hFQ92T8o/TZry+IW7AYk= Received: by 10.54.128.20 with SMTP id a20mr23448wrd; Thu, 02 Jun 2005 03:04:34 -0700 (PDT) Received: by 10.54.46.5 with HTTP; Thu, 2 Jun 2005 03:04:34 -0700 (PDT) Message-ID: Date: Thu, 2 Jun 2005 06:04:34 -0400 From: Fernando Grijalba Reply-To: Fernando Grijalba To: pgsql-sql@postgresql.org Subject: Re: Convert int to hex In-Reply-To: <6d8daee305060114074a9631e@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6d8daee305060114074a9631e@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.304 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/17 X-Sequence-Number: 21618 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 wrote: > On 6/1/05, Fernando Grijalba 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 >=20 > Sure you can go from integer to hex and back... > http://www.varlena.com/varlena/GeneralBits/104.php >=20 > Here's the example queries to get you started. >=20 > =3D# select to_hex(11); > to_hex > -------- > b > (1 row) >=20 > =3D# select x'ab'::integer; > int4 > ------ > 171 > (1 row) >