PLSQL2000
Programmer
- Jun 1, 2009
- 1
Hello,
I'm trying to convert cents to dollars, i.e add a decimal place. The problem I've encountered is that when the cents value is in hundreds, i.e. 100 cents = 1.00, it drops the .00 and just shows 1.
Below is an example of how I'm trying to do this... Is there a better way to do this?
This is the result I get:
Note I want it show this:
I'm trying to convert cents to dollars, i.e add a decimal place. The problem I've encountered is that when the cents value is in hundreds, i.e. 100 cents = 1.00, it drops the .00 and just shows 1.
Below is an example of how I'm trying to do this... Is there a better way to do this?
Code:
set serveroutput on;
declare
test1 number;
test2 number;
begin
test1 := 234;
test1 := round(test1/100, 2);
test2 := 200;
test2 := round(test2/100, 2);
dbms_output.put_line(test1);
dbms_output.put_line(test2);
end;
This is the result I get:
Code:
anonymous block completed
2.34
2
Note I want it show this:
Code:
anonymous block completed
2.34
2.00