PL/SQL Function to Find Square of Number

PL/SQL Function to Find Square of Number:



create or replace function sqr(no in number)
return number is sqr_no number;
begin
sqr_no:=no*no;
return(sqr_no);
end;

Calling Function:

declare
ono number;
sqno number;
begin
ono:=:ono;
sqno:=sqr(ono);
dbms_output.put_line('Original number is:'||ono);
dbms_output.put_line('Square number is:'||sqno);
end;

OUTPUT:

Original number is:5
Square number is:25




Leave a Reply

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

4 × 3 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.