00:43 0 Comments A+ a-

Write a PLSQL block to calculate square and Squreroot of a number.

Program:


declare
x int:=4;
squre int;
root int;
begin
squre:= x*x;
root:= sqrt(x);
dbms_output.put_line('The Square of the '||x||' is '|| squre);
dbms_output.put_line('The Square root of the '||x||' is '||root);
end;
/

Output:
The Square of the 4 is 16

The Square root of the 4 is 2