Oracle8i SQL&PLSQL基础 Oracle8i SQL_02 Database Transactions Consist of one of the following statements: DML statements that make up one consistent change to the data One DDL statement One DCL statement Database Transactions Begin when the first executable SQL statement is executed End with one of the following events: COMMIT or ROLLBACK DDL or DCL statement executes (mit) User exits System crashes Advantages MIT and ROLLBACK Ensure data consistency Preview data changes before making changes permanent Group logically related operations DELETE Controlling Transactions Transaction Savepoint A ROLLBACK to Savepoint B DELETE Savepoint B COMMIT INSERT UPDATE ROLLBACK to Savepoint A INSERT UPDATE INSERT ROLLBACK INSERT An mit occurs under the following circumstances: A DDL statement is issued A DCL statement is issued A normal exit from SQL*Plus, without explicitly MIT or ROLLBACK An automatic rollback occurs under an abnormal termination of SQL*Plus or a system failure Implicit Transaction Processing State of the Data Before COMMIT or ROLLBACK The previous state of the data can be recovered. The current user can review the results of the DML operations by using the SELECT statement. Other users cannot view the results of the DML statements by the current user. The affected rows are locked; other users cannot change the data within the affected rows. State of the Data MIT Data changes are made permanent in the database. The previous state of the data is permanently lost. All users can view the results. Locks on the affected rows are released; those rows are available for other users to manipulate. All savepoints are erased. Committing Data SQL> UPDATE emp 2 SET deptno = 10 3 WHERE empno = 7782; 1 row updated. Make the changes. Commit the changes. SQL> COMMIT; plete. State of the Data After ROLLBACK Discard all pending changes by using the ROLLBACK statement. Data changes are undone. Previous state of the data is restored. Locks on the