Re: Conversion from CHAR HEX

Поиск
Список
Период
Сортировка
От Shaun Thomas
Тема Re: Conversion from CHAR HEX
Дата
Msg-id 538634D1.80309@optionshouse.com
обсуждение исходный текст
Ответ на Conversion from CHAR HEX  (saqibrafique <saqibrafique@gmail.com>)
Список 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@optionshouse.com

______________________________________________

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


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: memory leaking ?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Error while upgrading from 8.4 to 9.3