CREATE PROCEDURE SP_Reporting(IN tablename VARCHAR(20)) proc_label:BEGIN IF tablename IS NULL THEN LEAVE proc_label; -- 跳出存儲過程,proc_label是個別名,在begin前起的別名 END IF; #proceed the codeEND;
參考地址:http://stackoverflow.com/questions/6260157/mysql-how-to-quit-exit-from-stored-proceduremysql