2

I am looking for a Built-in UDF or any other method to convert values of a string column to integer in my phoenix table for sorting using SELECT and ORDER BY. I searched in the apache language Manual, but no use. Any other suggestions also welcome.

Actual Query

select "values" from "test_table" 

I tried below approach but did not work

select TO_NUMBER("values", '\u00A4') from "test_table"
scoder
  • 2,451
  • 4
  • 30
  • 70

2 Answers2

2

TO_NUMBER returns decimal but you can cast the result to INTEGER

SELECT CAST(TO_NUMBER(MY_COLUMN) AS INTEGER) FROM MY_DB

Simbosan
  • 244
  • 2
  • 11
0
select TO_NUMBER(values) from test_table;

see https://phoenix.apache.org/language/functions.html#to_number

IceMimosa
  • 21
  • 3