codemaniacstudio

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

Practical Practice 5

Oracle Practice

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

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

SOLUTION

--Static code

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


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

TRY IT YOURSELF

Exit mobile version