23 lines
491 B
SQL
23 lines
491 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketClon_OneYear`(vTicketFk INT)
|
|
BEGIN
|
|
|
|
DECLARE vShipped DATE;
|
|
DECLARE vMaxDated DATE;
|
|
|
|
SELECT shipped, TIMESTAMPADD(YEAR,1,shipped)
|
|
INTO vShipped, vMaxDated
|
|
FROM vn.ticket
|
|
WHERE id = vTicketFk;
|
|
|
|
WHILE vShipped <= vMaxDated DO
|
|
|
|
SET vShipped = TIMESTAMPADD(WEEK, 1, vShipped);
|
|
|
|
CALL vn.ticketClon(vTicketFk, vShipped);
|
|
|
|
END WHILE;
|
|
|
|
END$$
|
|
DELIMITER ;
|