Practical Practice 4

Oracle Practice

Write a program to enter length and breadth of a rectangle and find its perimeter in PLSQL block.

Write a program to enter length and breadth of a rectangle and find its perimeter in PLSQL block.

SOLUTION

--Static code

set serveroutput on;
DECLARE 
length number := 5;
width number :=  10;
peri number;
BEGIN
peri := 2 *(length + width);
dbms_output.put_line('The Perimeter of a rectangle is :-'||peri);
END;
/
    


--Dynamic code 
set serveroutput on;
DECLARE 
length number := &length;
width number :=  &width;
peri number;
BEGIN
peri := 2 *(length + width);
dbms_output.put_line('The Perimeter of a rectangle is :-'||peri);
END;
/

TRY IT YOURSELF

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.