Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Is it possible to use to_number function in JPQL(Is it possible to use to_number in JPQL)
Is it possible to use to_number function in JPQL [message #630726] Mon, 04 October 2010 17:27 Go to next message
Kiran  is currently offline Kiran Friend
Messages: 8
Registered: October 2010
Junior Member
I have the following sql query
select * from hrwf.DEPT_DIV_UNIT_REP_NYU_T order by to_number(unit_no),to_number(div_no)

Is it possible to convert this into a named query. I could not find to_number in JPQL. Thanks for your time and help.

Re: Is it possible to use to_number function in JPQL [message #632403 is a reply to message #630726] Tue, 12 October 2010 19:17 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

There is no TO_NUMBER function in JPQL.

In EclipseLink (2.1) you can use the FUNC keyword to call a database function.

ORDER BY FUNC('TO_NUMBER', rep.unit_no)

You could also use EclipseLink Expressions to define the query (which support toNumber()), or use a native SQL query.

James : Wiki : Book : Blog : Twitter
Previous Topic:Secondary table with join on constant value
Next Topic:Parsing error in JPQL query
Goto Forum:

Current Time: Tue Apr 24 05:23:06 GMT 2018

Powered by FUDForum. Page generated in 0.01696 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software