TCL Statements in Trigger

Why are we not supposed to include TCL statements in a trigger?

Questions by bmsrao

Showing Answers 1 - 15 of 15 Answers

A Trigger may not issue any transactional control statements-COMMIT, ROLLBACK or SAVEPOINT. The trigger is fired as part of the execution of the triggering statement and is in the same transaction as the triggering statement. When the triggering statement is committed or rollback, the work in the trigger is committed or rollback as well.

lekurwale

  • Apr 3rd, 2009
 

We cannot use TCL like commit or rollback in Triggers, but by using Pragma_autonoumous Transaction we can use the same.

  Was this answer useful?  Yes

Vansat

  • Jun 16th, 2009
 

We cannot use TCL statements in triggers, because using them violates the integrity of the transaction. But if we want TCL statements to be used in triggers then that can be implemented by using Autonomous i.e. by providing PRAGMA AUTONOMOUS_TRANSACTION in the beginning of the trigger. We can use these types of triggers to maintain log details of a table.

manveshv

  • Dec 30th, 2009
 

The trigger is fired when an event occurs while manipulating the data in table.

So the trigger applies a lock on it restricting others to modify it.

Locks are released when a TCL command is executed. The trigger can't understand whether to release the locks applied or to continue and hence hangs.

Hence TCL commands are not entertained in the triggers.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions