Hi,
In ORACLE Code:
CREATE OR REPLACE FUNCTION FUN_Find_Factorial(pmNumber INTEGER) RETURN NUMBER AS
BEGIN
IF(pmNumber= 1) THEN
RETURN 1;
ELSE
-- Calling a Function recursively
RETURN(pmNumber * FUN_Find_Factorial(pmNumber-1));
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('The Error Message:'||SQLERRM);
END FUN_Find_Factorial; SELECT FUN_Find_Factorial(4) FROM DUAL; Code:
Output: 24 4*3*2*1 = 24;
Ya,I think if the nesting loop ends properly then can be proceed any number
N times in the
Stored Function / Procedure.