Write the stored procedure for the first time, write well to suppress flexion.
set @c_db := (select database());drop procedure if exists alter_tables_engine;delimiter //create procedure alter_tables_engine() begin declare db varchar(64); declare done boolean default 0; declare t varchar(64); declare table_names cursor for select table_name from information_schema.tables where table_schema = @c_db; declare continue handler for sqlstate ‘02000‘ set done = 1; open table_names; repeat fetch table_names into t; set @stmt = concat(‘alter table ‘, t, ‘ engine = InnoDB‘); prepare s from @stmt; execute s; deallocate prepare s; until done end repeat; close table_names; end;//delimiter ;call alter_tables_engine();drop procedure if exists alter_tables_type;
Finally, I do not have a Google to, how to unset previously defined user variables?
MySQL stored procedure modifies table storage engine to InnoDB