oracle中的复合触发器
我有一个复合触发器,在 after 语句中我对其他也有复合触发器的表进行了更新,如下面的代码所示:
create or replace
trigger TRIGGER
for insert or update on TABLE
COMPOUND trigger
after STATEMENT is
begin
update THEOTHERTABLE set VALUE = VALUE + 1 where COD = 1;
end after STATEMENT;
end;
更新只是一个简单的更新,看看是否有效。我希望它在 THEOTHERTABLE 上触发触发器,但只有在触发器不是复合触发器时才会触发。
这是 Oracle 复合触发器的问题还是只是我不理解的功能?
I have a compound trigger and in the after statement I have an update to other table that has also a compound trigger, like in the code below:
create or replace
trigger TRIGGER
for insert or update on TABLE
COMPOUND trigger
after STATEMENT is
begin
update THEOTHERTABLE set VALUE = VALUE + 1 where COD = 1;
end after STATEMENT;
end;
The update is just a simple one to see if works. I want it to fire the trigger on THEOTHERTABLE, but it only fires if the trigger is not compound.
Is this a problem with Oracle compound triggers or just a feature which I am not understanding?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我尝试重新创建您的场景,它似乎对我来说效果很好。所以我认为你应该再次审视你的实施。寻找您所编码的内容与此处接下来的内容之间的差异,也许这就是答案所在。
这是我的触发器
...这是测试数据......
这就是我在第一个表上发出更新时发生的情况...
I have attempted to re-create your scenario, and it appears to work fine for me. So I think you should look again at your implementation. Look for the differences between what you have coded and what follows here, and perhaps that is where the answer lies.
Here are my triggers
... here is the test data ...
... and this is what happens when I issue an update on the first table ...
如果您在编译触发器后执行此操作,它会起作用,但如果您再次尝试,即使使用其他数据,它也不会更新 THEOTHERTABLE
It works if you do it after compiling the trigger but if you try it again, even with other data, it won't update THEOTHERTABLE
我认为它不应该工作...如果您为 THEOTHERTABLE 创建一个过程并从此触发器调用该过程,那就更好了。
i don't think it should work...it would be better if you would create a procedure for THEOTHERTABLE and call that procedure from this trigger.