2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketClon_OneYear`(vTicketFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
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 ;
|