Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Help
Help,
I guess I need to use the round function to get my ouput like this: For a circle with radius 3, the diameter is 18.85 and the area is 28.27.
Currently my ouput is :
For a circle with radius 3, the diameter is 18,85 and the area is 28,27.
I've been looking around and can't find a answer. Anybody's help is grealty appericated. Thanks!
SQL> --PL/SQL Program that calculates the circumference and area of a
circle
SQL> DECLARE
2 pi CONSTANT NUMBER(9,7) := 3.1415926;
3 current_radius CONSTANT NUMBER(9) := 3;
4 diameter NUMBER (9,2);
5 area NUMBER(9,2);
6
7 BEGIN
8 diameter := 2 * pi * current_radius;
9 area := pi * current_radius ** 2;
10 DBMS_OUTPUT.PUT_LINE('For a circle with radius ' ||
current_radius ||', the diameter is '|| di
ameter ||' and the area is ' || area ||'.');
11
12
13 END;
14 /
For a circle with radius 3, the diameter is 18,85 and the area is
28,27.
PL/SQL procedure successfully completed. Received on Sun Feb 01 2004 - 13:38:01 CST
![]() |
![]() |