Re: parsing a string with a hexadecimal notation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: parsing a string with a hexadecimal notation
Дата
Msg-id 20086.1107982261@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: parsing a string with a hexadecimal notation  (Achilleus Mantzios <achill@matrix.gatewaynet.com>)
Список pgsql-sql
Achilleus Mantzios <achill@matrix.gatewaynet.com> writes:
> 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.

No, I think you could do it with a placeholder if you wanted.  The
secret is the (poorly documented) external syntax for a hex bit string:

regression=# select 'xBEEF'::bit varying;     varbit
------------------1011111011101111
(1 row)

So it should work to do "SELECT int4($1::bit varying)" and then pass
'xBEEF' as the string value for the parameter.
        regards, tom lane


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

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: How to iterate through arrays?
Следующее
От: "Ing. Jhon Carrillo"
Дата:
Сообщение: Function .. AS..?