Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

I have a very simple question but I didn't get any simple code to exit from SP using Mysql. Can anyone share with me how to do that?

CREATE PROCEDURE SP_Reporting(IN tablename VARCHAR(20))

BEGIN

     IF tablename IS NULL THEN

          #Exit this stored procedure here

     END IF;

   #proceed the code

END;

1 Answer

0 votes
by (40.4k points)

Use the below query:

CREATE PROCEDURE SP_Reporting(IN tablename VARCHAR(20))

proc_label:BEGIN

     IF tablename IS NULL THEN

          LEAVE proc_label;

     END IF;

     #proceed the code

END;

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jan 17, 2020 in SQL by anmolj (9k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

29.3k questions

30.6k answers

501 comments

104k users

Browse Categories

...