Can you use a commit statement within a database trigger?
-
-
Answer:
Yes, you can very definitely use transactions within a trigger in one of two common ways; 1. As with any other use of transactions - to ensure a collection of commands within the trigger are executed in a repeatable way in the event of failure. 2. To 'undo' the process that caused the trigger to fire. For example, the trigger might be doing some additional integrity checks and issuing a rollback to undo the initiating update/delete. --------- Come to think of it, I have never seen a commit on triggers. Triggers as you know are a last line defense based on an action that was carried out by an insert,update or delete. Hence, since the trigger exists on the server, and is only fired if one of the above conditions are executed then it seems pointless to use a commit in the trigger. Also commit goes along nicely with transactions where you begin the transaction and if all is well then you issue a commit, else if the transaction fails, then you issue a rollback.
wiki.answers.com Visit the source
Related Q & A:
- How can I use a button to retrieve a phone 'number' from contacts?Best solution by Stack Overflow
- Can you use a wire dog crate (like a Midwest) on a Via Rail train?Best solution by Yahoo! Answers
- When can I use the chat feature within Yahoo games?Best solution by Yahoo! Answers
- Can I use a Marshall Amplifier as a speaker in my car?Best solution by Yahoo! Answers
- Can I use a 4 ohm crossover with a high pass slope of 24 db with a 6 ohm tweeter that has a 6 db slope?Best solution by termpro.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.