Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我有表foo,我想foo在触发器触发时删除其他行t_foo:
foo
t_foo
CREATE OR REPLACE TRIGGER "t_foo" AFTER INSERT OR DELETE OR UPDATE ON foo /*delete some other records from foo that are not :NEW.* or :OLD.* \*
我将如何在不获取ORA-04091:表名的情况下执行此操作正在发生变化,触发器/函数可能看不到它。这甚至可能吗?
ORA-04091:
为什么不在存储过程中执行此操作,您可以将插入和删除包装在事务中,并且可以清楚地记录这种副作用行为?
请参阅Tom Kyte 关于此主题的权威文章。
这基本上意味着您的表中有相互依赖的行,可能是一个层次结构,具有从列到主键的自引用。你想过ON DELETE CASCADE吗?
ON DELETE CASCADE