drop PROCEDURE if exists my_procedure; create PROCEDURE my_procedure() BEGIN declare my_sqll varchar(500); set my_sqll='select * from aa_list'; set @ms=my_sqll; PREPARE s1 from @ms; EXECUTE s1; deallocate prepare s1; end;
《MYSQL数据库MySQL 存储过程中执行动态SQL语句的方法》要点:
本文介绍了MYSQL数据库MySQL 存储过程中执行动态SQL语句的方法,希望对您有用。如果有疑问,可以联系我们。
drop PROCEDURE if exists my_procedure; create PROCEDURE my_procedure() BEGIN declare my_sqll varchar(500); set my_sqll='select * from aa_list'; set @ms=my_sqll; PREPARE s1 from @ms; EXECUTE s1; deallocate prepare s1; end;
转载请注明本页网址:
http://www.vephp.com/jiaocheng/1258.html