What are COMMIT, ROLLBACK and SAVEPOINT statements in PL/SQL?
These are the three transaction specifications that are available in PL/SQL.
COMMIT: Whenever any DML operations are performed, the data gets manipulated only in the database buffer and not the actual database. In order to save these DML transactions to the database, there is a need to COMMIT these transactions. COMMIT transaction action does saving of all the outstanding changes since the last commit and the below steps take place:
The release of affected rows.
The transaction is marked as complete.
The details of the transaction would be stored in the data dictionary.
Syntax: COMMIT;
ROLLBACK: In order to undo or erase the changes that were done in the current transaction, the changes need to be rolled back. ROLLBACK statement erases all the changes since the last COMMIT.
Syntax: ROLLBACK;
SAVEPOINT: This statement gives the name and defines a point in the current transaction process where any changes occurring before that SAVEPOINT would be preserved whereas all the changes after that point would be released.
Syntax: SAVEPOINT <savepoint_name>;
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。