Reputation: 11
I am trying to create a procedure to update my database with multiple parameters. Here is my code:
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 is giving me a blank #1193 error with no other information. I've tried to search and implement the resolutions I have found regarding this error, but have not been able to figure it out.
Any ideas would be very welcome. Thanks in advance.
Upvotes: 0
Views: 2262
Reputation: 11
As @Drew pointed out, I omitted a declaration for fileName. Final Code:
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 ;
Upvotes: 1