Transaction Control Statements
Transaction control statements manage the changes made by DML statements and group DML statements into transactions.
iot internet of things training courses malaysia
These statements enable you to:
Make changes to a transaction permanent (
COMMIT).Undo the changes in a transaction, since the transaction started (
ROLLBACK) or since a savepoint (ROLLBACK TO SAVEPOINT). A savepoint is a user-declared intermediate marker within the context of a transaction.Set a point to which you can roll back (
SAVEPOINT).Establish properties for a transaction (
SETTRANSACTION).Specify whether a deferrable integrity constraint is checked following each DML statement or when the transaction is committed (
SET CONSTRAINT).
The following example starts a transaction named Update salaries. The example creates a savepoint, updates an employee salary, and then rolls back the transaction to the savepoint. The example updates the salary to a different value and commits.
ibm websphere training courses malaysia
SET TRANSACTION NAME 'Update salaries'; SAVEPOINT before_salary_update; UPDATE employees SET salary=9100 WHERE employee_id=1234 # DML ROLLBACK TO SAVEPOINT before_salary_update; UPDATE employees SET salary=9200 WHERE employee_id=1234 # DML COMMIT COMMENT 'Updated salaries';
Comments
Post a Comment