Experiment-10
Object: To calculate the areas of circles of
given radius till radius 8 using PL/SQL.
Requirements: Windows XP, Oracle 9i.
Program Code:
SQL>create
table mycircle
2 (area number(10),
3 radius number(2));
Table
Created.
SQL>set
serevroutput on;
Declare
Area
number(10);
Radius
number(2);
Pi
constant number(3,2):=3.14;
Begin
Radius:=&radius;
While
radius<8
Loop
Area:=pi*power(radius,2);
Insert
into mycircle values(area,radius);
Radius:=radius+1;
end
loop;
end;
Output:
Enter
value for radius:5
Old
6:radius:=&radius;
New6:radius:=5;
PL/SQ
procedure successfully completed.
SQL>select
* from mycircle;
AREA RADIUS
--------------- --------------------
79 5
113 6
154 7
Result: Thus the above program was compiled
and executed without any error.
0 comments:
Post a Comment