MYSQL解决动态sql执行
delimiter $$
create PROCEDURE clear()
BEGIN
DECLARE l_name VARCHAR(10);
DECLARE l_sql VARCHAR(800);
set l_name = 'name';
select concat('delete from student a where a.',l_name,' = ',char(39),'zs',char(39)) INTO l_sql from DUAL;
set @sql = l_sql;
PREPARE sl from @sql;
EXECUTE sl;
deallocate prepare sl;
END $$
delimiter;