declare i int
declare b int
declare c int
set @i=2
set @b=6
set @c=0
set @stmt = concat('insert into t_j_goods_name (id,`code`,`name`)
values(?,?,(select distinct `a` from sheet1 limit ?, 1))')
while @i<442 do
prepare s1 from @stmt
execute s1 using @b,@i,@c
deallocate prepare s1
set @i=@i+1,@b=@b+1,@c=@c+1
end while
end
这是我今天刚写的一个存储,你参考下。
CREATE PROCEDURE INSERT_P()BEGIN
SET @i=0
WHILE @i<3 DO
INSERT INTO TB_BASE_CITY(ID,CITY_NAME,EN_NAME,COUNTRY_NAME,MODIFY_USER,MODIFY_DT,CREATE_USER,CREATE_DT) VALUES (@i,'武汉','wuhan','1','admin','2016-7-4','admin','2016-7-4')
SET @i=@i+1
END WHILE
END
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)