0% found this document useful (0 votes)
2 views2 pages

PL SQL Code

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

Sum Of Two Numbers in PL/SQL:

declare

-- declare variable x, y

-- and z of datatype number

x number(5);

y number(5);

z number(7);

begin

-- Here we Assigning 10 into x

x:=10;

-- Assigning 20 into x

y:=20;

-- Assigning sum of x and y into z

z:=x+y;

-- Print the Result

dbms_output.put_line('Sum is '||z);

end;

PL/SQL Code for Calculating Rectangle Area :


DECLARE

Length NUMBER := 5;

Width NUMBER := 9;

Area NUMBER;
BEGIN

Area := Length * Width;

DBMS_OUTPUT.PUT_LINE('The area of the rectangle is: ' || Area);

END;

PL/SQL code to find the area of circle:

declare

radius number;

pi constant number:=3.14;

diameter number;

area number(10,2);

begin

radius:=12;

diameter:=2*radius;

area:=pi*radius*radius;

dbms_output.put_line('circle calculation');

dbms_output.put_line('radius of circle'||' '||radius);

dbms_output.put_line('diameter of circle'||' '||diameter);

dbms_output.put_line('area of circle'||' '||area);

end;

You might also like