You are viewing an older version of this section. View current production version.
Rolls back the open transaction if one exists.
ROLLBACK [ WORK ] [ AND [ NO ] CHAIN ] [ [ NO ] RELEASE ]
[ AND [ NO ] CHAIN ]and
[ [ NO ] RELEASE ]are ignored as these options are not currently supported by SingleStore DB.
- This command must be run on the master aggregator or a child aggregator node (see Node Requirements for SingleStore DB Commands.
- If the transaction is successful, then execute the COMMIT command to commit the changes.
For this example, consider the following
UPDATE Employee SET Name = "John" WHERE ID = 300; **** Query OK, 0 rows affected (0.00 sec) Rows matched: 0 Changed: 0 Warnings: 0
SELECT query to verify if the
UPDATE is correct:
SELECT * FROM Employee; **** +------+-------+ | ID | Name | +------+-------+ | 30 | Jim | | 20 | Rob | | 40 | Rick | +------+-------+
ROLLBACK since there were no matching results for the
ID and the
UPDATE was not successful.
Note: Before the user runs
ROLLBACK, only that user can see the updates made after the BEGIN statement was run.