When doing something like this, you have two options. First, if you're not dealing with too much data, you can select it all into a data structure, start a transaction, then do the inserts and deletes while iterating through the data structure. Once done you can commit/rollback.
The other option is to create two handles. The first one just performs the select and iterates through the rows. The second one does the inserts and deletes with transaction control.
You definitely cannot do this in a single statement, unless that statement calls a stored procedure which does the actual work :-)
Chris
M-x auto-bs-mode