SQL>
SQL> declare
2 function getArea(i_rad NUMBER)
3 return NUMBER
4 is
5 v_pi NUMBER:=3.14;
6 begin
7 return v_pi * (i_rad ** 2);
8 end;
9 function getArea(i_length NUMBER, i_width NUMBER)
10 return NUMBER
11 is
12 begin
13 return i_length * i_width;
14 end;
15 begin
16 DBMS_OUTPUT.put_line('Area (R=3):'||getArea(3));
17 DBMS_OUTPUT.put_line('Area (2x3):'||getArea(2,3));
18 end;
19 /
Area (R=3):28.26
Area (2x3):6
PL/SQL procedure successfully completed.
SQL>
SQL>
|