mysql创建存储过程,循环执⾏sql
mysql创建存储过程,循环执⾏sql
⼈⽣啊,错过、、、、、、
------------------------------
-- Procedure structure for Pro_gamegoldlog
------------------------------
DROP PROCEDURE IF EXISTS`Pro_gamegoldlog`;
DELIMITER;;
CREATE DEFINER=`root`@`localhost`PROCEDURE`Pro_gamegoldlog`( Qualification varchar(100))springboot分层架构
begin
declare i int ;
vbse实训心得体会成本会计declare ii int ;
set i=1;
set ii=1;
DROP TEMPORARY TABLE IF EXISTS tmp_table;
CREATE TEMPORARY TABLE tmp_table select *from gamegoldlog20200720;
while i <=length(Qualification)DO
erlang分布和gamma分布IF(substring(Qualification,i,1)=',')
mysql查看所有存储过程THEN
set @ttbName=CONCAT('select * from gamegoldlog',substring(Qualification,ii,i-ii));--'select * from gamegoldlog20200815'; set @ttbSql=CONCAT('INSERT INTO tmp_table ',@ttbName);
PREPARE stmt FROM @ttbSql;
EXECUTE stmt;
-- select @ttbName;
set ii=i+1;
ELSEIF(i =length(Qualification))
connectstring尚未初始化THEN
set @ttbName=CONCAT('select * from gamegoldlog',substring(Qualification,ii,i-ii+1));--'select * from gamegoldlog20200815'; set @ttbSql=CONCAT('INSERT INTO tmp_table ',@ttbName);
PREPARE stmt FROM @ttbSql;
EXECUTE stmt;
-- select @ttbName;
set ii=i+1;
ELSE
set ii=ii;
end IF;
set i=i+1;
end while;
select *from tmp_table;
input控件常用属性DROP TEMPORARY TABLE IF EXISTS tmp_table;
End
;;
DELIMITER;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论