DELIMITER |
CREATE TRIGGER RV1
after insert on Iscr
for each row
call ProcRV1(new.Usere,new.Sub);
create procedure ProcRV1(nUsere varchar(15),nSub varchar(15))
delete from Iscr
where Usere=nUsere && Sub=nSub && Usere=Sub
|
用表格中的这个当我尝试插入行时,我得到ERROR 1442 任何帮助??
感谢
答案 0 :(得分:1)
DELIMITER |
create procedure ProcRV1(nUsere varchar(15),nSub varchar(15))
BEGIN
delete from Iscr where Usere=nUsere && Sub=nSub && Usere=Sub;
END
|
CREATE TRIGGER RV1
after insert on Iscr
for each row
BEGIN
call ProcRV1(new.Usere,new.Sub);
END
|
DELIMITER ;
编辑:现在看到您的SP:
好的,所以你试图在插入当前表时删除当前表中的行。 MySQL不允许这样做。但必须有一个技巧。像这里完成的事情http://crazytoon.com/2008/03/03/mysql-error-1442-hy000-cant-update-table-t1-in-stored-functiontrigger-because-it-is-already-used-by-statement-which-invoked-this-stored-functiontrigger/
请参阅:http://dev.mysql.com/doc/refman/5.0/en/stored-program-restrictions.html
在存储的函数或触发器中,不允许通过调用函数或触发器的语句修改已经使用(用于读取或写入)的表。