我试图重新创建你的场景,它似乎对我来说很好。所以我认为你应该再看看你的实现。寻找您编码的内容与此处的内容之间的差异,也许这就是答案所在。
这是我的触发器
SQL> create or replace
2 trigger t1_compound
3 for insert or update on t1
4 compound trigger
5
6 after statement is
7 begin
8 update t2 set t1_id = nvl(t1_id,0) + 1 where cod = 12;
9 end after statement;
10 end;
11 /
Trigger created.
SQL>
SQL> create or replace
2 trigger t2_compound
3 for insert or update on t2
4 compound trigger
5
6 after statement is
7 begin
8 update t3 set t2_id = nvl(t2_id,0) + 1 where cod = 12;
9 end after statement;
10 end;
11 /
Trigger created.
SQL>
...这是测试数据...
SQL> select id, cod from t1
2 /
ID COD
---------- ----------
1 12
SQL> select id, cod, t1_id from t2
2 /
ID COD T1_ID
---------- ---------- ----------
11 12
SQL> select id, cod, t2_id from t3
2 /
ID COD T2_ID
---------- ---------- ----------
111 12
SQL>
...这就是我在第一个表上发布更新时发生的情况...
SQL> update t1 set dt = sysdate
2 where id = 1
3 /
1 row updated.
SQL> select id, cod, t1_id from t2
2 /
ID COD T1_ID
---------- ---------- ----------
11 12 1
SQL> select id, cod, t2_id from t3
2 /
ID COD T2_ID
---------- ---------- ----------
111 12 1
SQL>