Compare commits

...

3 Commits

1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
DELIMITER //
CREATE PROCEDURE seleccionar_tablas_18n()
BEGIN
DECLARE terminado INT DEFAULT 0;
DECLARE _nombre_tabla CHAR(64);
DECLARE _consulta CHAR(255);
DECLARE cursor_tablas CURSOR FOR SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'vn' AND TABLE_NAME LIKE '%18n%';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET terminado = 1;
OPEN cursor_tablas;
read_loop: LOOP
FETCH cursor_tablas INTO _nombre_tabla;
IF terminado = 1 THEN
LEAVE read_loop;
END IF;
SET @s = CONCAT('SELECT * FROM ', _nombre_tabla);
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END LOOP;
CLOSE cursor_tablas;
END//
DELIMITER ;