View Single Post
  #2 (permalink)  
Old 08-03-2007, 10:55 AM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default Re: Can a stored procedure call itself or recursive stored procedure? How many level

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.
__________________
-Murali..
Reply With Quote