Rollback
ROLLBACK (от roll back — англ. откатывать, возвращаться) — оператор языка SQL, который применяется для того, чтобы:
- отменить все изменения, внесённые начиная с момента начала транзакции или с какой-то точки сохранения (SAVEPOINT);
- очистить все точки сохранения данной транзакции;
- завершить транзакцию;
- освободить все блокировки данной транзакции.
Для успешного завершения всех изменений транзакции применяется оператор COMMIT.
Пример
Для добавления записи к таблице MyTable и последующей отмены этого действия нужно ввести следующие команды:
BEGIN TRANSACTION WORK;
INSERT INTO MyTable VALUES ('50', 'some string');
ROLLBACK WORK;
Литература
- Gunderloy, M.; Jorden, J.L.; Tschanz, D.W. Mastering Microsoft SQL Server 2005. — Wiley, 2006. — P. 200-201. — ISBN 9780471792239.
- Darie, C. and Watson, K. The Programmer's Guide to SQL. — Apress, 2008. — P. 271-274. — ISBN 9781430208006.
- Alapati, S. Expert Oracle Database 11g Administration. — Apress, 2009. — P. 338-339. — ISBN 9781430210160.
Ссылки
- COMMIT , Database SQL Reference, Oracle
- COMMIT, DB2 SQL, IBM
- Простая транзакция базы данных Oracle
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.