answersLogoWhite

0


Best 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.

---------

AnswerCome 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.
User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can you use a commit statement within a database trigger?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What happens when a rollback statement exicuted inside a trigger?

When a rollback statement is executed inside a trigger, it will cancel the entire transaction that the trigger is a part of, undoing any changes made by the trigger as well as any changes made by previous statements in the transaction. This can be helpful in cases where an error occurs in the trigger and you want to revert the transaction to its initial state.


What can a SQL UPDATE statement allow one to do within a table?

A SQL UPDATE statement allows the user to update existing records in a database table. For example, it could be used to update a customer's address, or a the price of a product.


Is it possible to perform a calculation within a database?

Yes you can. You can create queries that do calculations. You can write code for programs to do calculations in a database. Doing calculations is a significant element of what you do with a database, so yes you can do them within a database.


Differentiate DATA from a database?

A database is a collection of data. Data represents items that are stored within the database.


Relationship between a database and a table?

A table is contained within the database and consists of columns and rows. A table is meant to store data and, in relational databases, are related to other tables within the same database.


What is a connection within the data in a database?

relationship


A form that is inserted within another form?

Wether in docuement form or a database form within a database data input form a form within another form is called a sub form


What is the difference between database file and datafile?

Datafile is a group of files in each table space in an Oracle database. Database files are all files that are found within the database.


What is database table and filter?

Filters-filters look for specific information within a database regarding a subject.


What is international database?

An internal database is a Computerized collections of information obtained from data sources within the company.


What is an internal database?

An internal database is a Computerized collections of information obtained from data sources within the company.


Is a data table the same as a database?

No. A table is the primary object used within a database to store data. A typical database will consist of many tables.