0 votes
in Technology by (1.3m points)
What is a Recursive Stored Procedure?

1 Answer

0 votes
by (1.3m points)

A stored procedure which calls itself until a boundary condition is reached, is called a recursive stored procedure. This recursive function helps the programmers to deploy the same set of code several times as and when required. Some SQL programming languages limit the recursion depth to prevent an infinite loop of procedure calls from causing a stack overflow, which slows down the system and may lead to system crashes.

DELIMITER $$ 			 /* Set a new delimiter => $$ */
CREATE PROCEDURE calctotal(	
    IN number INT,			
    OUT total INT
) BEGIN
DECLARE score INT DEFAULT NULL; 	 
SELECT awards FROM achievements 	 
WHERE id = number INTO score;
IF score IS NULL THEN SET total = 0; 	 
ELSE
CALL calctotal(number+1); 	 
SET total = total + score; 	 
END IF;
END $$ 			 
DELIMITER ; 			 

    Related questions

    0 votes
    1 answer
    asked Dec 11, 2020 in Technology by JackTerrance (1.3m points)
    0 votes
    1 answer
    0 votes
    1 answer
    asked Dec 9, 2020 in Technology by JackTerrance (1.3m points)
    0 votes
    1 answer
    asked Dec 9, 2020 in Technology by JackTerrance (1.3m points)

    Learn More with Blogmepost

    blogmepost Online Test

    NCERT Questions & Answers

    • NCERT Class 12 Maths Solutions
    • NCERT Class 12 Physics Solutions
    • NCERT Class 12 Chemistry Solutions
    • NCERT Class 12 Biology Solutions
    • NCERT Class 10 Science Solutions
    • NCERT Class 10 Maths Solutions
    blogmepost Q&A

    CBSE Questions & Answers Portal

    • CBSE Class 12 Maths Questions Answers
    • CBSE Class 12 Physics Questions Answers
    • CBSE Class 12 Chemistry Questions Answers
    • CBSE Class 12 Biology Questions Answers
    • CBSE Class 10 Science Questions Answers
    • CBSE Class 10 Maths Questions Answers
    Blogmepost

    Learn Math Formula, Revise Notes

    • JEE Crash Course Questions & Answers
    • NCERT Course Questions and Answers
    • CBSE Board Questions Bank
    • ICSE Board Questions Bank
    • Free Study Materials
    • Question & Answers Bank for All Classes
    • Text Book Solutions
    • Previous Year Question Paper
    • NCERT Book Solutions

    • NCERT
    • NCERT Solutions
    • NCERT Solutions for Class 12 Maths
    • NCERT Solutions for Class 12 Physics
    • NCERT Solutions for Class 12 Chemistry
    • NCERT Solutions for Class 12 Biology
    • NCERT Solutions for Class 11 Maths
    • NCERT Solutions for Class 11 Physics
    • NCERT Solutions for Class 11 Chemistry
    • NCERT Solutions for Class 11 Biology
    • NCERT Solutions for Class 10 Maths
    • NCERT Solutions for Class 10 Science
    • NCERT Solutions for Class 9 Maths
    • NCERT Solutions for Class 9 Science
    • CBSE Classes

    • CBSE Class 5 Questions
    • CBSE Class 6 Questions
    • CBSE Class 7 Questions
    • CBSE Class 8 Questions
    • CBSE Class 9 Questions
    • CBSE Class 10 Questions
    • CBSE Class 10 Maths Questions
    • CBSE Class 11 Commerce Questions
    • CBSE Class 11 Engineering Questions
    • CBSE Class 11 Medical Questions
    • CBSE Class 12 Commerce Questions
    • CBSE Class 12 Maths Questions
    • CBSE Class 12 Engineering Questions
    • CBSE Class 12 Medical Questions
    • BOARDS

    • CBSE
    • ICSE
    • NCERT
    • IGCSE
    • Andhra Pradesh
    • Bihar
    • Gujarat
    • Jharkhand
    • Karnataka
    • Kerala
    • Madhya Pradesh
    • Maharashtra
    • Punjab
    • Rajasthan
    ...