INSERT ALL
is a special case of INSERT
, it will fire standard BEFORE/AFTER INSERT
triggers.
You would need ON EACH ROW
triggers to access the values of the row you are inserting. (un)Fortunately, you can't use row triggers to query the table you are trying to modify: you will run into ORA-04091
. See this recent question for why you should not use triggers if you want to do this kind of logic.
Use procedures. Easier to code, easier to maintain and debug. Triggers are the GOTO
of database logic.
Here's a similar advice from Tom Kyte:
anyway, you can do too much work in triggers, this may well be that time -- there is
nothing wrong with doing things in a more straightforward fashion (eg: using a stored
procedure to implement your transaction) [...]
The logic is a whole lot more understandable that way (and
maintainable and testable and everything)
With hindsight your case is even more complicated than what I thought at the beginning. Now my understanding of your requirement is: you want your statement to first remove all rows that will have the fooID
identifier, then insert another set of rows. However, the number of rows could be different so a standard row-per-row approach won't work.
I'm now not even sure you could do this with triggers, even if you persisted with this approach !