JPQL: convert varchar to number
hibernate, jakarta-ee, java, jpa, jpql
Solution
You can do the next:
CAST(e.salary AS NUMERIC(10,2))
Additionally, you can try:
`FUNC('TO_NUMBER', e.areaCode)`, `FUNC` allows for a database function to be call from JPQL.
`SQL('CAST(? AS CHAR(3))', e.areaCode)`, `SQL` allows for the usage and integration of SQL within JPQL.
Problem
How can i convert varchar to number in JPQL ??? I managed to do that in sql (Oracle) with this query: ``` SELECT Decode(Upper(column_name), Lower(column_name), To_Number(column_name), -1) FROM table ``` I want to do this conversion with JPQL. Thanks for your help