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
stho...@optionshouse.com

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to 
this email


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to