mysql循环插入语句,如何使循环变量i与字符串拼接起来构成新字符串然后插入到表中?
DELIMITER$$dropprocedureifexistsff$$CREATEPROCEDURE`mydatabase`.`ff`()BEGINdeclareiin...
DELIMITER $$
drop procedure if exists ff $$
CREATE PROCEDURE `mydatabase`.`ff`()
BEGIN
declare i integer;
set i=1;
while i <=3 do
begin
INSERT INTO `mydatabase`.`pictures`
(
`picture_name`,
`address`)
VALUES
(
"true_sample(1)",
"D\:\正样本\true_sample (1).jpg");
SET i=i+1;
end;
end while;
END$$
DELIMITER ;
call ff();
true_sample(1)中的1由i代替。 展开
drop procedure if exists ff $$
CREATE PROCEDURE `mydatabase`.`ff`()
BEGIN
declare i integer;
set i=1;
while i <=3 do
begin
INSERT INTO `mydatabase`.`pictures`
(
`picture_name`,
`address`)
VALUES
(
"true_sample(1)",
"D\:\正样本\true_sample (1).jpg");
SET i=i+1;
end;
end while;
END$$
DELIMITER ;
call ff();
true_sample(1)中的1由i代替。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询