DELIMITER ;;
CREATE PROCEDURE `CANCEL_ORDER`(IN order_id INT, IN buyer_user_id INT)
BEGIN
SET autocommit=0;
START TRANSACTION;
SELECT customer_user_id INTO @userid FROM orders WHERE id=order_id;
IF @userid=buyer_user_id THEN
UPDATE orders SET status='failed',canceled_at=UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) WHERE id=order_id;
COMMIT;
ELSE
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Error: Customer ID in orders does not match with given buyer_user_id', MYSQL_ERRNO = 1003;
ROLLBACK;
END IF;
END;;
DELIMITER ;
第 2 行的 ERROR 1064 (42000):您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获取在 ' SET autocommit=0; 附近使用的正确语法;开始交易;SELECT customer_user_id INTO ' 在第 3 行
嗨 frds,如何纠正它