当前位置:主页 > 数据库 > Mysql >

MySQL 存储过程中执行动态SQL语句的方法

时间:2022-01-30 11:22:16 | 栏目:Mysql | 点击:

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;

您可能感兴趣的文章:

相关文章