Tuesday, June 19, 2018

Create a function for factorial and use in PL/SQL code - DBMS (Function)


create or replace function factorial (no in number)
return number is ans number(5);
a number(5);
begin
a:=no;
ans:=1;
while a > 0
loop
ans:=ans*a;
a:=a-1;
end loop;
return ans;
end;

No comments:

Post a Comment