Reputation: 61
I have 2 columns in 2 different tables: col1
->table1
and col2
-> table2
. One of them contains values that are not UNIQUE and the other one stores the times each values of table1
appeared. I need to create a trigger that will re-calculate col2
on update of col1
. I read somewhere that you can not query the updating table in trigger, then how can i do this? Can anyone help me?
table1: pri_key col1
1 2
2 2
3 2
4 3
table2: pri_key(col1) col2
1 0
2 3
3 1
4 0
p/s:sorry for the bad english
Upvotes: 1
Views: 2578
Reputation: 1653
You'll need to use a compound trigger. An example can be found here:
Oracle trigger after insert or delete
Upvotes: 1