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 C3A6D8B9B86 for ; Wed, 9 Feb 2005 12:58:37 +0000 (GMT) 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 94313-10 for ; Wed, 9 Feb 2005 12:58:19 +0000 (GMT) Received: from matrix.gatewaynet.com (matrix.gatewaynet.com [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id 62E148B9B2E for ; Wed, 9 Feb 2005 12:58:19 +0000 (GMT) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id j19DZUeM009155; Wed, 9 Feb 2005 15:35:30 +0200 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id j19DZPU0009151; Wed, 9 Feb 2005 15:35:30 +0200 Date: Wed, 9 Feb 2005 15:35:25 +0200 (EET) From: Achilleus Mantzios To: =?ISO-8859-1?Q?K=D6PFERL_Robert?= Cc: pgsql-sql@postgresql.org Subject: Re: parsing a string with a hexadecimal notation In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/118 X-Sequence-Number: 20229 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