Reputation: 161
I have a command to execute inside oracle triggers after a modification of a table. I need this command to run once (even if there is 100 rows updated), and only when there is rows updated.
FOR EACH ROW
allow to be sure to send the command only when there is rows updated, so how could I stop its execution after the first loop ?
Upvotes: 0
Views: 389
Reputation: 4818
It looks you're going to use compound trigger
. In for each row
section you need to collect rowid
s to update and in after statement
run whole update
Upvotes: 1
Reputation: 2138
Use global package variable.
1) Reset it to null in before update statement trigger.
2) Save values/inc counter in for each row trigger
3) do final check in after update statement trigger and fire your logic inly once regardless number of affected rows
Upvotes: 0