我在向查询结果分配变量然后在表中插入该变量的值时遇到问题。该行被插入到表中,但'gPayRef'字段(应该包含变量的值)为空
这是我的代码: -
SET @eReceipt =
(SELECT DISTINCT `gpayref`
FROM `TRANSACTION`
WHERE `ereceipt` = '12345');
INSERT INTO reversals (gpayref, reversalinitby, reversalinitdate, reason, status)
VALUES (@eReceipt,
reversalinitby,
Now(),
reason,
(SELECT id
FROM `status`
WHERE NAME = 'Reversal pending'));
SELECT Row_count() INTO res;