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

30 lines
541 B
MySQL
Raw Normal View History

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