How to get ride of ORA-01426: numeric overflow error?
Hi,
I am tring to create this function for factorial calculation.
CREATE OR REPLACE FUNCTION fac (n POSITIVE) RETURN INTEGER IS
BEGIN
IF n = 0 THEN
RETURN 1;
ELSIF n = 1 THEN
RETURN 1;
ELSE
RETURN n * fac(n - 1);
END IF;
END fac;
When i am executing this function as
select FAC(34) from dual
*
ERROR at line 1:
ORA-01426: numeric overflow
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: number precision too large
Can someone help me about the problem with this function.
Thanks
Regards,
Kumar