CANCEL statement
Each statement within SurrealDB is run within its own transaction. If a set of changes need to be made together, then groups of statements can be run together as a single transaction, either succeeding as a whole, or failing without leaving any residual data modifications. While a transaction will fail if any of its statements encounters an error, the CANCEL statement can also be used to cancel a transaction manually.
Statement syntax
Example usage
The following query shows example usage of this statement.
CANCEL is not used to automatically cancel a transaction based on a condition such as inside an IF..ELSE block. Instead, a THROW statement is used. THROW can be followed by any value, usually a string containing context behind the error.