Oracle's description of Things

Source: Internet
Author: User
Tags savepoint

4 states of Things in Oracle:

commit--Submit

rollback--All rolls back

SavePoint name;--defines a point that rolls back to here: for example: SavePoint A;

Rollback to [savepoint]name--rollback to a specified point such as rollback to A; roll it back to a place like this.

Example:

--------------------------------------------example 1:--The first step: Copy an EMP's new table "Cemp" including data;//altogether 14 rows CREATE table Cemp as SELECT * FROM emp;--The second step: delete the delete from cemp where sal>2500;//delete some rows--step three: rollback;//all rolled back here, After the query is still 14 lines---------------------------------------------example 2:--first step: Delete the department number is 10 employee delete from Cemp where deptno=10;-- The second step: Delete the department number is 20 employee delete from Cemp where deptno=20;--step three: Set a rollback point asavepoint a;--4th step: Then delete the employee with the department number 30, and now the employee table is empty delete from Cemp where deptno=30;--5th step: Roll Back to "a" this rollback point rollback to A;select *from cemp;--will see deptno=30 employees still exist, which is to roll back to a point

  

Oracle's description of Things

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.