当前位置: 代码迷 >> Oracle开发 >> ORA-04098: 触发器 'SCOTT.ORDERDELETE' 无效且未通过重新验证,该如何处理
  详细解决方案

ORA-04098: 触发器 'SCOTT.ORDERDELETE' 无效且未通过重新验证,该如何处理

热度:317   发布时间:2016-04-24 08:01:57.0
ORA-04098: 触发器 'SCOTT.ORDERDELETE' 无效且未通过重新验证
create trigger orderupdate
  before update on orderform_list for each row
 begin 
  update orderform set diaodu=1  
  from orderform a,deleted d,inserted i
  where a.orderform_id=d.orderform_id
 end
  orderupdate

create trigger orderdelete 
 before delete on orderform_list
 for each row
begin
 delete orderform
  from orderform a,deleted b
  where a.orderform_id=b.orderform_id
 end
  orderform_list


我写的2 个触发器都有错误,但我不知道怎么改,哪位高手能够指点一下。 其中我的orderform_list和orderform表中都有diaodu这项,我想改orderform_list中的diaodu,然后通过触发器将orderform里的diaodu也改为1。第二个是,我想删除orderform_list中diaodu为1的一行数据,同时通过触发器也把orderform里diaodu为1的那一行数据删除!

------解决方案--------------------
SQL code
--改一下试试CREATE TRIGGER orderupdate  BEFORE UPDATE ON orderform_list  FOR EACH ROWBEGIN  UPDATE orderform     SET diaodu = 1 FROM orderform a   WHERE a.orderform_id = :new.orderform_id;END orderupdate;/CREATE TRIGGER orderdelete  BEFORE DELETE ON orderform_list  FOR EACH ROWBEGIN  DELETE orderform FROM orderform a   WHERE a.orderform_id = :old.orderform_id;END orderdelete;/
------解决方案--------------------
就是说trigger还没建好咯
把4楼的代码拷下来 直接放到一个command window 下酒可以了啊
或是分作两段 去掉 / 一个一个手工执行
  相关解决方案