Re: Help with text(decimal) to hex conversion
От | Merlin Moncure |
---|---|
Тема | Re: Help with text(decimal) to hex conversion |
Дата | |
Msg-id | CAHyXU0wP+OBF-cTLTmKk9WQEbsc8hSnky-aYrg55R6x9dVqT1g@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Help with text(decimal) to hex conversion (Wei Shan <weishan.ang@gmail.com>) |
Список | pgsql-novice |
On Tuesday, March 22, 2016, Wei Shan <weishan.ang@gmail.com> wrote:
Hi all,The method suggested so far doesn't actually work.I'm trying to convert a text datatype to hex. The maximum hex returned will be 20 octets. I'm hoping to do it within PostgreSQL so I can call it like a function (to_hex).psql> select column from table limit 5;---------------------48490182132044936354939764883475860925100630405370179282710077180495386354981010517297675790156(5 rows)psql> select to_hex(column_name::bigint) from tablelimit 5;to_hex------------------434b2c5fab740543448d91fd51870dbddf71c3488ee543bdfc223a187ff6eae061420d75a674c(5 rows)I also tried the following suggestions.psql> select encode(column::bytea,'hex') from table limit 1;encode----------------------------------------31303037373138303439353338363335343938
Why did you cast to bytea? Remove that.
merlin
В списке pgsql-novice по дате отправления: