Now we will see how savepoint is used in COMMIT and ROLLBACK.
Savepoint:
Savepoint name;
Here Savepoint is a keyword used for creating the savepoint name is name of savepoint to be created.all changes made after a savepoint has been declared can be undone by issuing the ROLLBACK to a savepoint name .we can use it save the changes permanently by issuing the COMMIT to a savepoint name.
Example:
Lets say we create a savepoint ‘s’ by issuing the following statement
Savepoint s;
Now we are going to update different coloumn by update statement
Update emp set salary=salary+100;
Update emp set emp_contactno=’9830755710’ where emp_name=’abhishek’;
Finally we can leave the above changes by issuing the
Rollback to savepoint s ;
This will discard all the above changes made to database upto the savepoint s.
If we want to store the chages permanently to the database then we can use the commit command instead of rollback like this
Commit to savepoint s;
This will save all the above changes made to database upto the savepoint s.
Savepoint:
- Way of implementing subtranction .
Syntax:
Savepoint name;
Here Savepoint is a keyword used for creating the savepoint name is name of savepoint to be created.all changes made after a savepoint has been declared can be undone by issuing the ROLLBACK to a savepoint name .we can use it save the changes permanently by issuing the COMMIT to a savepoint name.
Example:
Lets say we create a savepoint ‘s’ by issuing the following statement
Savepoint s;
Now we are going to update different coloumn by update statement
Update emp set salary=salary+100;
Update emp set emp_contactno=’9830755710’ where emp_name=’abhishek’;
Finally we can leave the above changes by issuing the
Rollback to savepoint s ;
This will discard all the above changes made to database upto the savepoint s.
If we want to store the chages permanently to the database then we can use the commit command instead of rollback like this
Commit to savepoint s;
This will save all the above changes made to database upto the savepoint s.
Related Article:
I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebook, twitter