日期:2014-05-16  浏览次数:20719 次

触发器问题,这已经是第三次问了,高手拜托看看啊
我写了个这样的触发器.顺便说下,表ntt里有no,no_no,ct这3个字段,no字段是个auto_increment列
CREATE   TRIGGER   ntt_ct   BEFORE   INSERT
ON   ntt   FOR   EACH   ROW   BEGIN
UPDATE   ntt   SET   ct=1   WHERE   no=NEW.no_no;
END
那个替换;用的DELIMITER   |我当然也加了

但现在我如果执行INSERT语句,就会出如下错误
Can 't   update   table   'ntt '   in   stored   function/trigger   because   it   is   already   used   by   statement   which   invoked   this   stored   function/trigger

这是怎么回事

------解决方案--------------------
CREATE OR REPLACE TRIGGER "ntt_ct " AFTER
UPDATE ON ntt FOR EACH ROW
declare
stmt varchar2(500);
begin
stmt := ' UPDATE ntt SET ct=1 WHERE no=NEW.no_no; '
/