我正在尝试使用多个参数创建一个更新数据库的过程。这是我的代码:
DELIMITER //
CREATE PROCEDURE updateImages (IN stagingID INT, IN streetName VARCHAR(50), IN numberOfImages INT)
BEGIN
DECLARE count INT;
SET count = 1;
WHILE count < (numberOfImages + 1) DO
SET fileName = CONCAT(streetName, ' (mls) (', count, ').jpg');
INSERT INTO images_tbl VALUES
(NULL, stagingID, fileName, 0);
SET count = count + 1;
END WHILE;
END //
DELIMITER ;
PHPMyAdmin给了我一个空白的#1193错误,没有其他信息。我试图搜索并实现我发现的有关此错误的解决方案,但一直未能弄明白。
任何想法都会非常受欢迎。提前谢谢。
答案 0 :(得分:1)
正如@Drew指出的那样,我省略了fileName的声明。最终守则:
DELIMITER //
CREATE PROCEDURE updateImages (IN stagingID INT, IN streetName VARCHAR(50), IN numberOfImages INT)
BEGIN
DECLARE count INT;
DECLARE fileName VARCHAR(100);
SET count = 1;
WHILE count < (numberOfImages + 1) DO
SET fileName = CONCAT(streetName, ' (mls) (', count, ').jpg');
INSERT INTO images_tbl VALUES (NULL, stagingID, fileName, 0);
SET count = count + 1;
END WHILE;
END //
DELIMITER ;