salix/db/routines/vn/procedures/sales_mergeByCollection.sql

37 lines
588 B
MySQL
Raw Permalink Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`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 16:36:07 +00:00
CALL ticket_mergeSales(vTicketFk);
END LOOP;
CLOSE cCur;
END$$
DELIMITER ;