Informix Error -853: Current transaction has been rolled back due to error or missing COMMIT WORK.
Cause and resolution
Current transaction has been rolled back due to error or missing COMMIT WORK.
While Informix SQL was executing SQL statements from a command file, it received an error return code or reached the end of the file but found no COMMIT WORK statement. Since a transaction was in progress (either the file contained BEGIN WORK, or the database is ANSI compliant), Informix SQL rolled the transaction back. (It cannot leave the transaction open, and it cannot assume success even when no error was returned.)
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-853 fires when the interactive tool, executing SQL statements from a command file, either hits
an error return code or reaches end-of-file without finding a COMMIT WORK — per the official
guidance, since a transaction was in progress (the file contained BEGIN WORK, or the database
is ANSI compliant), the tool rolls it back rather than leaving it open or assuming success.
- A command file's transaction block missing a closing
COMMIT WORK, per the official guidance — the file ended before the transaction was explicitly closed. - A statement earlier in the file returning an error, per the official guidance, which the tool responds to by rolling back rather than continuing and risking a partial, unintended commit.
- A database that's ANSI compliant, per the official guidance, where every statement runs
inside an implicit transaction even without an explicit
BEGIN WORKin the file — the same missing-COMMIT WORKrisk applies there too.
Solutions / Resolution
- Add an explicit
COMMIT WORKat the end of the command file's transaction block, per the official guidance's implied fix. - Check for an earlier error in the file that triggered the rollback, per the official guidance, if the missing-commit explanation doesn't fit — review the file's full output for an error before this final rollback notice.
- Remember this applies even without an explicit
BEGIN WORKon an ANSI-compliant database, per the official guidance — don't assume the rollback implies aBEGIN WORKwas missed if the database itself is ANSI compliant.
Examples
A missing COMMIT WORK
BEGIN WORK;
UPDATE orders SET status = 'shipped' WHERE order_id = 42;
-- file ends here, no COMMIT WORK
-- -853: transaction rolled back
Corrected
BEGIN WORK;
UPDATE orders SET status = 'shipped' WHERE order_id = 42;
COMMIT WORK;
Diagnostic Checks
- Check the command file for a
COMMIT WORKat the end of every transaction block. - Review the file's full execution output for an earlier error, not just this final rollback notice.
- Check whether the database is ANSI compliant, in case an implicit transaction (with no
BEGIN WORKin the file) is the context.
Related Errors / Related Topics
- -535 — "Already in transaction." A related transaction-management error, about a redundant
BEGIN WORKrather than a missingCOMMIT WORK.
Add an explicit COMMIT WORK, and check for an earlier error in the file if that alone doesn't
explain it — including on ANSI-compliant databases, where transactions can be implicit.