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!

Whole number conversion to decimal

944524Jan 23 2015 — edited Jan 23 2015

Hi,

I need to convert a whole number to decimal of 2 precision and insert into table where the column data type is number.

For eg :

insert into Table(balance)

select amount*rateĀ  from Master_Table;

Here the data type of balance column is Number. Is there a way to round the result value which is whole number to 2 decimal precision and if there is no whole number just round it to 2 decimal precision.

rate column is also Number(14,2) where values will be like 1.2356, 150.22 e.t.c

Output:

Table

Balance

1213.00

12311.00

-1111.00

-11.00

It can be using to_char but since my datatype of balance of target table is Number i dont want to change it.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 20 2015
Added on Jan 23 2015
8 comments
7,667 views