answersLogoWhite

0

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

15y ago

What else can I help you with?

Related Questions

What happens when a rollback statement exicuted inside a trigger?

You would have to have an "if" statement that says" IF an error occurs and the field is not updated (your code would be specific) then "rollback". You would want to name the section so you can rollback by name to be specific. If you did a generic rollback, all operations within the trigger would be rolled back--even the successful ones. If you put rollback statements within triggers, you need to make sure your logic is flawless and all bases are covered. You would want to test the trigger for the results you expect.


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.


Can you explain how to use the SELECT statement in SQL to perform mathematical operations on data in a database table?

Yes, in SQL, you can use the SELECT statement along with mathematical operators like , -, , / to perform calculations on data in a database table. For example, you can add, subtract, multiply, or divide values from different columns or apply functions to calculate results. Just include the mathematical operation within the SELECT statement to perform the desired calculation.


What is a connection within the data in a database?

relationship


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.


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 an internal database?

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


What is international database?

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


What is database table and filter?

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