Intellipaat 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.7k 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
3 answers
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer
asked Jul 10, 2019 in SQL by Tech4ever (20.3k points)

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...