Hi,
I want to calculate factorials of very large numbers. However numbers greater than 83 do not produce the actual results. The below function is the one that I use
create or replace function FN_FACTORIAL(p_num IN INTEGER)
RETURN NUMBER
AS
p_fact NUMBER :=1;
i INTEGER;
BEGIN
if(p_num = 0)
then
return 1;
else
for i in 1..p_num
loop
p_fact := p_fact*i;
end loop;
end if;
return p_fact;
END;
I know the number data type exceeds its precision and hence it does not work. Can you give me a work around. I cannot use BINARY_INTEGER or BINARY_FLOAT as well since I use Oracle 10g.
Thank you in advance.
Regards,
Prithwish.