DELIMITER $$
DROP PROCEDURE IF EXISTS `proc_ordertourist_cancel`$$
CREATE PROCEDURE proc_ordertourist_cancel(IN p_userid INT, IN p_touristorderid INT)
SQL SECURITY INVOKER
body:
BEGIN
DECLARE c_touristorder_source INT;
-- 监听数据库存储过程出现异常
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
SELECT
- 100;
END;
-- 结束监听
START TRANSACTION;
IF EXISTS (SELECT
*
FROM qr_touristorder qt
WHERE qt.touristorder_id = p_touristorderid AND (qt.touristorder_state > 0 OR
qt.touristorder_state = - 1)) THEN
ROLLBACK;
SELECT
- 1;
LEAVE body;
END IF;
SELECT
1;
COMMIT;
END$$
DELIMITER ;