插入循环时的MySql [英] MySql while insert loop

查看:82
本文介绍了插入循环时的MySql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,我对以下代码有问题>>



Greetings, I have a problem with the following code >>

DELIMITER $$

DROP PROCEDURE IF EXISTS insert_ten_rows $$

CREATE PROCEDURE insert_ell_rows ()
BEGIN
DECLARE crs INT DEFAULT 0;

WHILE crs < 11 DO
SET crs = crs + 1;
Insert into events Values(`img\air_show\air (`+crs`).jpg`,`Air Show`,`Air Base`,`0`);
END WHILE;
END $$





我的问题是语法问题,我不确定是不是因为img\air_show\air(`+ crs`).jpg`,但请你帮忙我如何更好地解决这个问题。非常感谢你提前



My problem is a syntax issue, I'm not sure if it's because of " `img\air_show\air (`+crs`).jpg` " but may you please aid in how I can better tackle this problem. Thank you so much in advance

推荐答案

DROP PROCEDURE IF EXISTS insert_ten_rows
DROP PROCEDURE IF EXISTS insert_ten_rows


CREATE PROCEDURE insert_ell_rows()
BEGIN
DECLARE crs INT DEFAULT 0 ;

WHILE crs< 11 DO
SET crs = crs + 1 ;
插入事件 (`img\air_show\air(`+ crs`).jpg`,`Air Show`,`Air Base`,`0`);
END WHILE ;
END
CREATE PROCEDURE insert_ell_rows () BEGIN DECLARE crs INT DEFAULT 0; WHILE crs < 11 DO SET crs = crs + 1; Insert into events Values(`img\air_show\air (`+crs`).jpg`,`Air Show`,`Air Base`,`0`); END WHILE; END






我的问题是语法问题,我不确定是不是因为`img\air_show \ air(`+ crs`).jpg`但请你帮忙我怎样才能更好地解决这个问题问题。非常感谢你提前



My problem is a syntax issue, I'm not sure if it's because of " `img\air_show\air (`+crs`).jpg` " but may you please aid in how I can better tackle this problem. Thank you so much in advance


这篇关于插入循环时的MySql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆