adding trailing zeros [message #117666] |
Thu, 28 April 2005 15:42  |
abeiko
Messages: 29 Registered: March 2005
|
Junior Member |
|
|
I have a field that is number(10,3). I need a built-in function that will add a zero onto the end of the number if there is only 2 digits after the decimal. For example, if the number is 85.23 I need it to be 85.230. But if the number is 85.123, I want it left alone.
I have tried using Column <column_name> format 999.990, but that isn't working.
Any help would be appreciated.
|
|
|
|
Re: adding trailing zeros [message #117679 is a reply to message #117669] |
Thu, 28 April 2005 16:46   |
abeiko
Messages: 29 Registered: March 2005
|
Junior Member |
|
|
Rpad will add enough zeros to make the field length equal to 10. There is no way to tell it to add zeros only if the digits after the decimal don't equal 3.
I only want a zero at the end if it doesn't have 3 digits after the decimal place. I need all numbers in the column to be formatted to three decimal places (number 10,3).
Again -- 85.12 should come out as 85.120
85.123 should come out as 85.123
|
|
|
|
Re: adding trailing zeros [message #118144 is a reply to message #117666] |
Tue, 03 May 2005 05:04  |
rumasinha
Messages: 12 Registered: May 2005 Location: Bangalore
|
Junior Member |
|
|
create table temp
( a number(10,3));
insert into temp values (85.23);
insert into temp values (85.123);
column a format 9999999.999;
select * from temp;
A
--------
85.230
85.123
column a format 9999999.990;
select * from temp;
A
--------
85.230
85.123
|
|
|