33 lines
736 B
SQL
33 lines
736 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`parking_new`(vStart INT, vEnd INT, vSectorFk INT)
|
|
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 ;
|