2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`parking_new`(vStart INT, vEnd INT, vSectorFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
DECLARE vRow INT;
|
|
|
|
DECLARE vColumn INT;
|
|
|
|
DECLARE vLetters VARCHAR(200);
|
|
|
|
DECLARE vLettersLength INT;
|
|
|
|
|
|
|
|
SET vColumn = vStart;
|
|
|
|
SET vRow = 1;
|
|
|
|
SET vLetters = 'ABCDEF';
|
|
|
|
SET vLettersLength = LENGTH(vLetters);
|
|
|
|
|
|
|
|
WHILE vColumn <= vEnd DO
|
|
|
|
|
|
|
|
REPLACE vn.parking(`column`, `row`, `code`, sectorFk)
|
|
|
|
VALUES(vColumn, vRow, CONCAT(vColumn,MID(vLetters,vRow,1)), vSectorFk);
|
|
|
|
|
|
|
|
SET vRow = vRow + 1;
|
|
|
|
|
|
|
|
IF vRow > vLettersLength THEN
|
|
|
|
|
|
|
|
SET vRow = 1;
|
|
|
|
SET vColumn = vColumn + 1;
|
|
|
|
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
END WHILE;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|