SQLite Forum

table locked when dropping a temp table
Login
Attempting to DROP a table gets an SQLITE_LOCKED error if there are any active statements belonging to the same database connection (sqlite3*). This is true even if the table is a TEMP table.

An statement becomes active when sqlite3_step() is called on it. It ceases being active when sqlite3_step() returns something other than SQLITE_ROW, or when sqlite3_reset() or sqlite3_finalize() is called on it.