I have a decimal value in the entity. ENTITY NAME : ORDER Amount = Decimal Through OQL, i am trying to execute the qeury SELECT CAST(O.Amount as String) as Total_Amount from ORDER O; For example, Case 1 : Amount = 0.00 - Query returns 0.00000000 Case 2: Amount = 10.00 - Query returns 10.00 How to retrieve 0.00 in the first case.
asked
MANIKUMAR SUBBAIAH
2 answers
2
Round first:
CAST(ROUND(O.Amount, 2) as string)
answered
Martin Koelewijn
0
Hi Manikumar,
You can try the following query:
SELECT CASE WHEN O.Amount = 0 THEN '0.00' ELSE CAST(O.Amount AS String) END AS Total_Amount FROM ORDER O;