Alla dynamiska SQL-filer måste använda MySQL Förberedda uttalanden .
DROP PROCEDURE IF EXISTS `LIST`;
DELIMITER $$
create procedure LIST(in tableName varchar(35))
BEGIN
SET @sql=CONCAT('select * from ',tablename);
PREPARE stmt1 FROM @sql;
EXECUTE stmt1;
DEALLOCATE PREPARE stm1;
END$$
test:
call LIST('course');
call LIST('tutor');