SQLite Forum

multiple queries
Login
Given multiple statements, the CLI either completes or stops at the first error. (I'd use the CLI for building/testing scripts).

Programmatically, stopping at the first error is an option (examine the return code from sqlite3_step and stop if not zero). However, this makes the user experience terse/repetitive in that subsequent statements in the multiple queries statement may also be 'incorrect'.

My point in [asking](https://sqlite.org/forum/forumpost/6c14b83af8?t=h) was to see if there was some way of resuming with the next statement on encountering an error. From what you say, there isn't. Fair enough!

To validate each statement in a multiple query statement, I am contemplating splitting at ; and executing each statement and reporting failures in the format "statements nx, ny failed" thereby allowing the user to revisit each failing statement in one go. Of course there is no guarantee that the revision will correct every invalid statement successfully; given this, stopping on the first error is a very reasonable option.