rollback

Execute the SQL ROLLBACK WORK statement.

Available in:

Apps (win) Apps (char) Reportwriter RPC Standalone PL
X X X X X

Syntax

void rollback([update])
keyword      update

Description

update (optional) specifies that the transaction is for update. The default (unspecified) is read-only.

Notes

Some database systems do not provide the capability of specifying read-only or update transactions. On these systems, option update is ignored. See also commit().

Example

Deletes rows in a table and confirm it with the user before committing the work.
{
int n_rows;
n_rows = exec_sql("DELETE FROM staff WHERE id = 20");
if (n_rows > 0) {
  printf("You are about to delete" ^^ to_char(n_rows) ^^ "rows");
  if (prompt("Proceed (Y/N) ==> ") == "Y") commit();
  else rollback();
 }
}