Well to put it across in a few words. A trigger is a part of a transaction and not a transaction in itself. So Oracle doesn’t let you commit in a trigger. You can commit in a trigger by using PRAGMA AUTONOMOUS TRANSACTION. But that isn’t advisable. Even using triggers is not advisable by some :D. I read a funny comment on a forum once.
“Being lazy is the reason that pushes anyone to use triggers.
Being the most laziest person in the world pushes to desire a commit inside the trigger action.”
Well I am really lazy i guess then :)) I use a lot of triggers in my day to day daily tasks. And i cannot tell you how many times i have solved problems for business requirements; where complex reports need to be generated based on column values. I could certainly use pl/sql for those tasks but triggers make it so much easier and less complex. Plus i like to use triggers along with shell scripts and the fusion of both of them work like a charm.
I will try to dedicate my next few posts specific to triggers.