Console - ROLLBACK
Aborts a transaction, rolling the database back to its save point.
Syntax
BEGIN
For more information on transactions, see Transactions. To initiate a transaction, use the
BEGIN
command. To save changes, seeCOMMIT
command.
Example
Initiate a new transaction:
- orientdb>
BEGIN
- Transaction 1 is running
- orientdb>
Attempt to start a new transaction, while another is open:
- orientdb>
BEGIN
- Error: an active transaction is currently open (id=1). Commit or rollback before starting a new one.
- orientdb>
Make changes to the database:
- orientdb>
INSERT INTO Account (name) VALUES ('tx test')
- Inserted record 'Account#9:-2{name:tx test} v0' in 0,004000 sec(s).
- orientdb>
View changes in database:
- orientdb>
SELECT FROM Account WHERE name LIKE 'tx%'
- ---+-------+--------------------
- # | RID | name
- ---+-------+--------------------
- 0 | #9:-2 | tx test
- ---+-------+--------------------
- 1 item(s) found. Query executed in 0.076 sec(s).
- orientdb>
Abort the transaction:
- orientdb>
ROLLBACK
- Transaction 1 has been rollbacked in 4ms
- orientdb>
View rolled back database:
- orientdb>
SELECT FROM Account WHERE name LIKE 'tx%'
- 0 item(s) found. Query executed in 0.037 sec(s).
- orientdb>
For more information on other commands, see Console Commands.