Can a COMMIT statement (in SQL) ever fail? How?

COMMIT may fail. You might have had sufficent resources to log all the changes you wished to make, but lack resources to actually implement the changes.

And that’s not considering other reasons it might fail:

  1. The change itself might not fit the constraints of the database.

  2. Power loss stops things from completing.

  3. The level of requested selection concurrency might disallow an update (cursors updating a modified table, for example).

  4. The commit might time out or be on a connection which times out due to starvation issues.

  5. The network connection between the client and the database may be lost.

And all the other “simple” reasons that aren’t on the top of my head.

Leave a Comment