I need to get all names of tables that match with the regex and for that value given do an update query, to do this I created the following MySQL procedure but MySQL tells me that I have an error at line 3
I have the following MySql procedure:
CREATE PROCEDURE example()
BEGIN
DECLARE bdone INT;
DECLARE var1 VARCHAR(250);
DECLARE curs CURSOR FOR SHOW tables like '%contenidos_extra%';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET bDone = 1;
OPEN curs;
SET bdone = 0;
REPEAT
FETCH curs INTO var1,, b;
UPDATE var1 SET `valor`='modified' WHERE nombre = 'prueba';
UNTIL bdone END REPEAT;
CLOSE curs;
END
mysql tells me that error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3