Re: Hex Integer Input

From: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Hex Integer Input
Date: 2003-03-11 12:14:30
Message-ID: Pine.LNX.4.44.0303111014180.23176-100000@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 7 Mar 2003, Tom Lane wrote:

> Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> writes:
> > Hi, is there a way to enter integer data by their HEX
> > representation??
>
> I'm not sure that this is SQL-spec, but at least as of 7.3, you can
> coerce a bitstring literal to int, so:
>
> z=# select x'0f';
> ?column?
> ----------
> 00001111
> (1 row)
>
> z=# select x'0f'::int4;
> int4
> ------
> 15
> (1 row)

Thanx.

>
> Looks like it works for int8 as well.
>
> regards, tom lane
>

--
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel: +30-210-8981112
fax: +30-210-8981877
email: achill(at)matrix(dot)gatewaynet(dot)com
mantzios(at)softlab(dot)ece(dot)ntua(dot)gr

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christoph Haller 2003-03-11 15:32:33 Re: Special characters in SQL queries
Previous Message Achilleus Mantzios 2003-03-11 12:13:28 Re: Hex Integer Input