我在mysql中创建了Trigger,虽然没有计算季节变量的触发值中的错误。
触发:
CREATE TRIGGER `Total_orders` BEFORE INSERT ON Orders
FOR EACH ROW
BEGIN
DECLARE sum Float;
SET sum = sum + Amount;
SET @Sum = sum;
END$$
输出是:
select @Sum;
+------+
| @Sum |
+------+
| NULL |
+------+