MySQL Equivalent of 'return' in a stored procedure
Posted on 2009-02-11
Hi, I am in the process of converting an MSSQL DB over to MySQL and have run into a problem with my stored procedures.
I often put logic into my stored procedures for data validation etc and if something passed in is not valid then I stop the execution of the stored procedure by using the 'return' command in MSSQL
-- validate input
if (@input = 'bad')
-- do something else
insert into some_table values (...)
However I cannot find an equivalent way of stopping the execution of the stored proc in MySQL as 'return' is not allowed. Some of these procs get quite long so I dont want to add a load of nested if statements.
Does anyone know a way of doing this in MySQL?