MySQL stored procedure syntax -
i trying create basic stored procedure in mysql. has increment int value in table. want stored procedure dropped if exists. sql inside stored procedure works fine on own btw.
i error:
you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'end' @ line 5
i have tried:
delimiter $$ drop procedure if exists sp_version_increment$$ create procedure `sp_version_increment`() begin set @ver = (select version version limit 1) + 1; update version set version = @ver end$$ delimiter delimiter $$ drop procedure if exists sp_version_increment$$ create procedure `sp_version_increment`() begin set @ver = (select version version limit 1) + 1; update version set version = @ver end
solution:
delimiter $$ drop procedure if exists sp_version_increment$$ create procedure `sp_version_increment`() begin set @num = (select number version limit 1) + 1; update version set number = @num; end
try
drop procedure if exists sp_version_increment; delimiter $$ create procedure `sp_version_increment`() begin set @ver = (select version version limit 1) + 1; update version set version = @ver; end $$ delimiter ; drop procedure if exists sp_version_increment; delimiter $$ create procedure `sp_version_increment`() begin set @ver = (select version version limit 1) + 1; update version set version = @ver; end $$ delimiter ;
Comments
Post a Comment