From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: KÖPFERL Robert <robert.koepferl@sonorys.at>
Cc: pgsql-sql@postgresql.org
Subject: Re: parsing a string with a hexadecimal notation
Date: Wed, 9 Feb 2005 15:35:25 +0200 (EET)
Message-ID: <Pine.LNX.4.44.0502091526170.8966-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <ED4E30DD9C43D5118DFB00508BBBA76EB165B4@neptun.sonorys.at>
O KÖPFERL Robert Ýãñáøå óôéò Feb 9, 2005 :
> I intend to retrieve an int value in an integer variable from a string with
> a hexadecimal notation of a number.
> Which function is appropriate to do
> i int4
> i = ???('BEAF')
You can do something like
foodb=# SELECT int4(X'FF'::bit varying);
int4
------
255
(1 row)
but i suspect you must prepare your statement out of sql.
E.g. in java:
String hex="FF";
st = con.prepareStatement("select int4(X'"+hex+"'::bit varying");
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
--
-Achilleus
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: achill@matrix.gatewaynet.com, robert.koepferl@sonorys.at
Subject: Re: parsing a string with a hexadecimal notation
In-Reply-To: <Pine.LNX.4.44.0502091526170.8966-100000@matrix.gatewaynet.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