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

ADBMS

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 views2 pages

ADBMS

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

(1) Write a PL/SQL block to Calculate area and perimeter

of square.
declare
s number(4):=&s;
begin
dbms_output.put_line("The area of square
is"||s||"is:-"||s*s);
dbms_output.put_line("The parametre of square
is"||s||"is:-"||4*s);
end;
(2) Write a PL/SQL block to Calculate square of a given
number. Accept number from user.
declare
s number(4):=&s;
begin
dbms_output.put_line("The area of square
is"||s||"is:-"||s*s);
end;
(3) Write a PL/SQL block to display Sum of Digits of a
given number.
DECLARE
n INTEGER;
temp_sum INTEGER;
r INTEGER;
BEGIN
n := 123456;
temp_sum := 0;
WHILE n <> 0 LOOP
r := MOD(n, 10);
temp_sum := temp_sum + r;
n := Trunc(n / 10);
END LOOP;
dbms_output.Put_line('sum of digits = '
|| temp_sum);
END;

You might also like