Oracle database transaction related "Weber products must be a boutique"

Source: Internet
Author: User
Tags savepoint

  1. The concept of a transaction:
    Transaction: A transaction consists of a set of DML statements that make up a logical operation

    The transaction begins with an end, and the transaction begins with a DML statement, ending with conmmit and rollback.
    The following situation causes the transaction to end:

    1. Execute commit or ROLLBACK statement

    2. Executing DDL or DCL statements

    3. User exits

    4. System crashes

  2. a transaction can contain the following statements:

    1. DML statements that make consistent changes to the data

    2. A DDL statement

    3. A DCL statement

  3. the process of DDL and DCL statement execution:

    1. Make a commit first;

    2. Performing DML operations on a data dictionary

    3. If successful, commit, if failed, rollback

  4. ensure consistency of data: No data submitted, no other users can see

    Check for changes in data before the data is permanently changed

    Grouping logical-related operations

  5. Controlling things: Save points (SavePoint)
  6. Sql>Select* fromT; EMPNO ename JOB MGR hiredate SAL COMM DEPTNO----- ------ --------- ----- --------- ----- ----- ------7369ALLEN salesman7902  --dec- the   the            -    1Y -    2W -SQL>savepoint S1; SavePoint created. SQL> INSERT into T (empno,ename) VALUES (3,'b'); 1row created. SQL>savepoint S2; SavePoint created. SQL>delete T;4rows deleted. SQL>Select* fromt; no rows selected SQL>rollback to savepoint S2; Rollback complete. SQL>Select* fromT; EMPNO ename JOB MGR hiredate SAL COMM DEPTNO----- ------ --------- ----- --------- ----- ----- ------7369ALLEN salesman7902  --dec- the   the            -    1Y -    2W -    3B -SQL>rollback to savepoint S1; Rollback complete. SQL>Select* fromT; EMPNO ename JOB MGR hiredate SAL COMM DEPTNO----- ------ --------- ----- --------- ----- ----- ------7369ALLEN salesman7902  --dec- the   the            -    1Y -    2W -----here to notice ah, because rollback to the S1 This save point, also can not be in rollback to S2 this savepoint---because S1 in this save point is not recorded to S2 savepoint information----SQL>rollback to savepoint s2;rollback to savepoint S2*ERROR at line1: ORA-01086: savepoint'S2'Never established

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.