0 votes
1 view
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.3k 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
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...