From: | Shaun Thomas <sthomas(at)optionshouse(dot)com> |
---|---|
To: | saqibrafique <saqibrafique(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Conversion from CHAR HEX |
Date: | 2014-05-28 19:11:13 |
Message-ID: | 538634D1.80309@optionshouse.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 05/27/2014 09:47 AM, saqibrafique wrote:
> fm_db_Server1=# *select to_hex(to_number(substr(from_ip, 1, 3), '999')) as
> price from operator;*
> /ERROR: function to_hex(numeric) does not exist
> LINE 1: select to_hex(to_number(substr(from_ip, 1, 3), '999')) as p...
> ^
There's no to_hex function for the NUMERIC type. You also don't need the
to_number function call. And of course, your function usage will break
if there are ever less than 3 characters in your first octet.
Change your query to this:
select to_hex(split_part(from_ip, '.', 1)::INT) as price
from operator;
--
Shaun Thomas
OptionsHouse, LLC | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604
312-676-8870
sthomas(at)optionshouse(dot)com
______________________________________________
See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email
From | Date | Subject | |
---|---|---|---|
Next Message | John Lumby | 2014-05-28 20:52:47 | Re: Extended Prefetching using Asynchronous IO - proposal and patch |
Previous Message | Tom Lane | 2014-05-28 18:37:48 | Re: memory leaking ? |