IT Community - Software Programming, Web Development and Technical Support

Can a stored procedure call itself or recursive stored procedure? How many level SP n

This is a discussion on Can a stored procedure call itself or recursive stored procedure? How many level SP n within the Database Support forums, part of the Web Development category; Can a stored procedure call itself or recursive stored procedure? How many level SP nesting possible?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-03-2007, 07:13 AM
H2o H2o is offline
D-Web Analyst
 
Join Date: Jul 2007
Posts: 246
H2o is on a distinguished road
Default Can a stored procedure call itself or recursive stored procedure? How many level SP n

Can a stored procedure call itself or recursive stored procedure? How many level SP nesting possible?
__________________
H2O

Without us, no one can survive..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #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..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
stored procedure itbarota Database Support 3 03-10-2008 09:43 PM
how to get out parameter of stored procedure ? Murali PHP Programming 0 12-16-2007 04:57 AM
Stored procedure gets executed twice chris ASP and ASP.NET Programming 4 11-01-2007 03:08 AM
Stored procedure gets executed twice chris VB.NET Programming 0 10-30-2007 08:55 AM
How to call stored procedure using HTTP SOAP? oxygen XML and SOAP 1 07-26-2007 04:28 AM


All times are GMT -7. The time now is 07:00 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0