#1172-结果由多个行组成
我正在接收#1172-结果由多个行组成
错误,每当我尝试在MySQL中的表中插入一些值时,我都会搜索此错误,并发现触发器给出了问题(它具有在其中选择
语句):
以下是我的触发代码
DELIMITER $
CREATE OR REPLACE TRIGGER book
AFTER INSERT ON books
FOR EACH ROW
BEGIN
DECLARE slot_id INT;
SELECT slotno INTO slot_id FROM books WHERE slotno = new.slotno;
UPDATE slots SET slot_status = 0 WHERE slotno = slot_id;
END;
$
,当我第一次尝试时,该代码正常工作,但是现在几周后,它给出了此错误 请告诉我如何解决它,或者如何在没有触发器的情况下实现同一件事,
该如何选择
语句返回多个行?
I am receiving #1172 - Result consisted of more than one row
error whenever I try to insert some values in my table in MYSQL, I searched for this error and found out that the trigger is giving the problem (it has SELECT INTO
statement in it)
Following is my trigger code
DELIMITER $
CREATE OR REPLACE TRIGGER book
AFTER INSERT ON books
FOR EACH ROW
BEGIN
DECLARE slot_id INT;
SELECT slotno INTO slot_id FROM books WHERE slotno = new.slotno;
UPDATE slots SET slot_status = 0 WHERE slotno = slot_id;
END;
$
this code was working fine when I tried it for the first time but now after some weeks it is giving this error
pls tell me how can I resolve it or how can I implement the same thing without triggers
How is this SELECT INTO
statement returning more than one row?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论