Home » SQL & PL/SQL » SQL & PL/SQL » commit inside a trigger (merged 3)
commit inside a trigger (merged 3) [message #364598] Tue, 09 December 2008 04:21 Go to next message
gauravpuri2002
Messages: 24
Registered: October 2007
Location: Bangalore
Junior Member
hi

Why it is not possible to commit inside a non-autonomous trigger
Re: commit inside a trigger [message #364606 is a reply to message #364598] Tue, 09 December 2008 04:29 Go to previous messageGo to next message
karthick_arp@yahoo.com
Messages: 6
Registered: November 2006
Location: India
Junior Member

Because trigger are procedural code that gets executed when a event like INSERT, UPDATE or DELETE happens.

So we can consider them as a part of a open transaction. And hence we cant commit in between the transaction.

Let say you have a insert trigger. You insert a record and your trigger gets fired. Now the trigger updates a table and commits. Now outside the trigger that is in the main process a error occurs. So you want to rollback your insert. But as you have committed inside the trigger that will not be possible.

And this is the reason for which oracle does not allow you to commit inside a trigger.

Thanks,
Karthick.
Re: commit inside a trigger (merged 3) [message #364619 is a reply to message #364598] Tue, 09 December 2008 05:15 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Once again STOP repeating your question.
I deleted the last one and will do it with the next ones with the same question.

Regards
Michel
Previous Topic: how to fix ORA-00904 Error
Next Topic: compnent "gettimeband" must be declared
Goto Forum:
  


Current Time: Sun Dec 04 14:50:29 CST 2016

Total time taken to generate the page: 0.08417 seconds