salix/db/routines/vn/functions/getTicketTrolleyLabelCount.sql

21 lines
444 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getTicketTrolleyLabelCount`(vTicket INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
DECLARE vLabelCount INT DEFAULT 0;
SELECT labelCount INTO vLabelCount
FROM ticketTrolley
WHERE ticket = vTicket;
SET vLabelCount = vLabelCount +1 ;
REPLACE ticketTrolley(ticket,labelCount)
SELECT vTicket, vLabelCount;
RETURN vlabelCount;
END$$
DELIMITER ;