0% found this document useful (0 votes)
7 views

PL SQL Code

Uploaded by

studentbca232
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

PL SQL Code

Uploaded by

studentbca232
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
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