Loading TOC...


xdmp:rollback() as empty-sequence()


Roll back the current transaction.

Usage Notes

When a transaction is rolled back, the current statement immediately terminates, updates made by any statement in the transaction are discarded, and the transaction terminates.

Transactions running in "update" or "query" transaction mode should be explicitly rolled back, using this function. Failure to explicitly commit or roll back such a transaction leaves the transaction open until transaction timeout, thus unnecessarily holding resources and locks, potentially blocking other transactions.

Transactions running in "auto" transaction mode may also use this function, to roll back a transaction without raising an error.

The result of a statement terminated with xdmp:rollback is always the empty sequence.

This function is equivalent to calling xdmp:transaction-rollback for the current host and transaction: xdmp:transaction-rollback(xdmp:host(), xdmp:transaction()).

See Also


  (: multi-statement transaction :)
  declare option xdmp:transaction-mode "update";

  xdmp:document-insert("/docs/first.xml", <first/>);
  xdmp:document-insert("/docs/second.xml", <second/>);

  => Empty. The transaction is rolled back. The documents are
     not added to the database. The transaction ends.

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.