[SQL] Hex to Number conversion
[SQL] Hex to Number conversion
От:
anand086 <anand086@gmail.com>
Дата:
Hi,
We have a Oracle system were the hex characters are converted to number
using TO_NUMBER function, like below.
sql> select to_number('cd08cfba70ede0a2','xxxxxxxxxxxxxxxx') from dual;
TO_NUMBER('CD08CFBA70EDE0A2','XXXXXXXXXXXXXXXX')
-------------------------------------------------- 14774286977254416546
How can I achieve the same in postgres.
# select to_number('cd08cfba70ede0a2','xxxxxxxxxxxxxxxx');
ERROR: invalid input syntax for type numeric: " "
Time: 142.581 ms
Regards,
Anand
--
View this message in context: http://www.postgresql-archive.org/Hex-to-Number-conversion-tp5980300.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
Re: [SQL] Hex to Number conversion
От:
Andreas Kretschmer <andreas@a-kretschmer.de>
Дата:
Am 27.08.2017 um 07:28 schrieb anand086: > How can I achieve the same in postgres. test=*# select x'1fcd'::int; int4 ------ 8141 (1 Zeile) Regards, Andreas -- 2ndQuadrant - The PostgreSQL Support Company. www.2ndQuadrant.com