2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sales_mergeByCollection`(vCollectionFk INT)
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
DECLARE vDone BOOL;
|
|
|
|
-- Fetch variables
|
|
|
|
DECLARE vTicketFk INT;
|
|
|
|
|
|
|
|
DECLARE cCur CURSOR FOR
|
|
|
|
SELECT ticketFk
|
|
|
|
FROM vn.ticketCollection
|
|
|
|
WHERE collectionFk = vCollectionFk;
|
|
|
|
|
|
|
|
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
|
|
|
SET vDone = TRUE;
|
|
|
|
|
|
|
|
OPEN cCur;
|
|
|
|
|
|
|
|
myLoop: LOOP
|
|
|
|
|
|
|
|
SET vDone = FALSE;
|
|
|
|
|
|
|
|
FETCH cCur INTO vTicketFk;
|
|
|
|
|
|
|
|
IF vDone THEN
|
|
|
|
LEAVE myLoop;
|
|
|
|
END IF;
|
|
|
|
|
2024-08-27 08:47:09 +00:00
|
|
|
CALL vn.ticket_mergeSales(vTicketFk);
|
2024-01-15 11:31:03 +00:00
|
|
|
|
|
|
|
END LOOP;
|
|
|
|
|
|
|
|
CLOSE cCur;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|