JPQL:将varchar转换为数字 [英] JPQL: convert varchar to number
本文介绍了JPQL:将varchar转换为数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在JPQL中将varchar转换为数字?
How can i convert varchar to number in JPQL ???
我通过以下查询在sql(Oracle)中做到了这一点:
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
我想用JPQL进行这种转换.
I want to do this conversion with JPQL.
感谢您的帮助
推荐答案
您可以执行下一个:
CAST(e.salary AS NUMERIC(10,2))
此外,您可以尝试:
-
FUNC('TO_NUMBER', e.areaCode)
,FUNC
允许从JPQL调用数据库功能.
FUNC('TO_NUMBER', e.areaCode)
,FUNC
allows for a database function to be call from JPQL.
SQL('CAST(? AS CHAR(3))', e.areaCode)
,SQL
允许在JPQL中使用和集成SQL.
SQL('CAST(? AS CHAR(3))', e.areaCode)
, SQL
allows for the usage and integration of SQL within JPQL.
这篇关于JPQL:将varchar转换为数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文