SQLite Forum

multiple queries
Login
I've sorted the loop using pzTail.

```
SQL is: select * from highscores;select * from ajay;select * from highscores where 0 = 1;select date("now");
SQL executed is: select * from highscores;
SQL remaining is: select * from ajay;select * from highscores where 0 = 1;select date("now");
SQL executed is: select * from ajay;
SQL remaining is: select * from highscores where 0 = 1;select date("now");
SQL executed is: select * from highscores where 0 = 1;
SQL remaining is: select date("now");
SQL executed is: select date("now");
SQL remaining is:
```
Having started with multiple statements, every iteration progresses to the next SQL statement.

However, if a statement encounters an error, the SQL in that iteration and those following is wrong. I introduced a deliberate error in the second SQL statement ... <i>select<b>x</b></i> instead of <i>select</i> as the first time round:

```
SQL is: select * from highscores;selectx* from ajay;select * from highscores where 0 = 1;select date("now");
SQL executed is: select * from highscores;
SQL remaining is: selectx* from ajay;select * from highscores where 0 = 1;select date("now");
SQL executed is:                 /* goes wrong hereon */
SQL remaining is: * from ajay;select * from highscores where 0 = 1;select date("now");
SQL executed is:
SQL remaining is:  from ajay;select * from highscores where 0 = 1;select date("now");
SQL executed is:
SQL remaining is:  ajay;select * from highscores where 0 = 1;select date("now");
SQL executed is:
SQL remaining is: ;select * from highscores where 0 = 1;select date("now");
SQL executed is: ;select * from highscores where 0 = 1;
SQL remaining is: select date("now");
SQL executed is: select date("now");
SQL remaining is:
```

Any guidance on overcoming invalid SQL statements when in a prepare/step/finalize loop?