我在MySQL 5.5.41
中遇到存储过程问题。问题是在程序执行期间会抛出错误 - Error code: 1172, SQLState: 42000, Message: Result consisted of more than one row
。奇怪的是它在执行语句时被抛出:
INSERT INTO TB__X
(FK__A, FK__B, FK__C, FK__D, E, F, G, H, I, J, L)
VALUES
(9106, 4927, NULL, 3, 4.9990234375, 20, 0, 0, 1, 0, 1);
表格是:
CREATE TABLE `TB__X` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`FK__A` int(11) NOT NULL,
`FK__B` int(11) NOT NULL,
`FK__C` int(11) DEFAULT NULL,
`FK__D` int(11) NOT NULL,
`E` double NOT NULL,
`F` int(11) NOT NULL,
`G` double NOT NULL,
`H` tinyint(4) NOT NULL,
`I` tinyint(4) NOT NULL,
`J` tinyint(4) NOT NULL,
`K` TEXT,
`L` tinyint(4) NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `IX_U_1` (`FK__B`,`FK__C`,`D`),
KEY `I__2` (`FK__A`),
KEY `I__3` (`FK__C`),
KEY `I__4` (`F`),
KEY `I__5` (`FK__D`),
CONSTRAINT `FK__1` FOREIGN KEY (`FK__B`) REFERENCES `TB__B` (`ID`),
CONSTRAINT `FK__2` FOREIGN KEY (`F`) REFERENCES `TB__F` (`ID`),
CONSTRAINT `FK__3` FOREIGN KEY (`FK__C`) REFERENCES `TB__C` (`ID`),
CONSTRAINT `FK__4` FOREIGN KEY (`FK__D`) REFERENCES `TB__D` (`ID`),
CONSTRAINT `FK__5` FOREIGN KEY (`FK__A`) REFERENCES `TB__A` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=13575 DEFAULT CHARSET=utf8
是否有人知道此错误在insert
声明中的含义?
答案 0 :(得分:3)
我已找出问题的原因。事实证明,我正在插入数据的表上有TRIGGER AFTER INSERT
,并且触发器内部是一个SELECT INTO
语句,它返回多行。