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

26 lines
532 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketRefund_upsert`(
vRefundTicketFk INT,
vOriginalTicketFk INT
)
READS SQL DATA
BEGIN
/**
* Common code for ticketRefund triggers
*
* @param vRefundTicketFk
* @param vOriginalTicketFk
*/
DECLARE vIsDeleted BOOL;
SELECT COUNT(*) INTO vIsDeleted
FROM ticket
WHERE id IN (vRefundTicketFk, vOriginalTicketFk)
AND isDeleted;
IF vIsDeleted THEN
CALL util.throw('The refund ticket can not be deleted tickets');
END IF;
END$$
DELIMITER ;