agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedHex to Number conversion
3+ messages / 2 participants
[nested] [flat]
* Hex to Number conversion
@ 2017-08-27 05:28 anand086 <anand086@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: anand086 @ 2017-08-27 05:28 UTC (permalink / raw)
To: pgsql-sql
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.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Hex to Number conversion
@ 2017-08-27 07:25 Andreas Kretschmer <andreas@a-kretschmer.de>
parent: anand086 <anand086@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Kretschmer @ 2017-08-27 07:25 UTC (permalink / raw)
To: pgsql-sql
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
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Hex to Number conversion
@ 2017-08-28 23:50 anand086 <anand086@gmail.com>
parent: Andreas Kretschmer <andreas@a-kretschmer.de>
0 siblings, 0 replies; 3+ messages in thread
From: anand086 @ 2017-08-28 23:50 UTC (permalink / raw)
To: pgsql-sql
Thanks for your reply.
Regards,
Anand
--
View this message in context: http://www.postgresql-archive.org/Hex-to-Number-conversion-tp5980300p5980523.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2017-08-28 23:50 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-08-27 05:28 Hex to Number conversion anand086 <anand086@gmail.com>
2017-08-27 07:25 ` Andreas Kretschmer <andreas@a-kretschmer.de>
2017-08-28 23:50 ` anand086 <anand086@gmail.com>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox