I can do this statement to get a rowid list:
select first 1000 rowid from table1 where last_update < today-30;
but I can't use it as a subquery for a delete statement:
delete from table1
where rowid in ( select first 1000 rowid from table1
where last_update < today-30 );
It gives me this error:
944: Cannot use "first", "limit" or "skip" in this context.
How can I fix that?
As noted in your comment, the FIRST, LIMIT and SKIP clauses are not allowed in sub-queries. This is an annoying lack of consistency.
The workaround you allude to is:
Unless you run with REPEATABLE READ isolation, there is a TOCTOU (time of check, time of use) risk in that some of the rows in the main table identified by ROWID values in the temporary table may have been altered between the time of the SELECT and the DELETE operations. There's a small chance that an old row may have been deleted and a new row inserted with the same ROWID.