Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

number with 2 decimal

S567Feb 15 2018 — edited Feb 15 2018

Hi team,

I want to display Number with 2 decimals (no $)”, for example, if the value is ‘30’, the output should look like ’30.00’; if the value is ‘42.8’, the output should look like ’42.80’.

I dont want to round the value to nearest value.

I used round(column,2) but if the value if 30 The output is still showing as 30 not 30.00

below is the sample data..

WITH A AS(

SELECT 48.1  amount,30 amount1,234.455 amount2 from dual )

SELECT

CAST(round(amount,2) AS FLOAT)   amount

,CAST(round(amount1,2) AS FLOAT)  amount1

,cast(round(amount2,2) as float)  amount2

from A;

when i executed the result was like below

48.1      30    234.46

But expected is

481.10    30.00     234.46

Thanks

This post has been answered by BEDE on Feb 15 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 15 2018
Added on Feb 15 2018
9 comments
547 views