How to do a while loop to delete rows based on rowcount?
As I understand the problem, you want to leave 1000 rows in a table that starts with > 1 million.   In SQL Server, I ran I to problems with the delete statement locking the table, and also taking a long time to execute.  All the deleted records have to go into the transaction log. 

What worked better was to select the records I wanted to keep into a new table, and then rename the tables. 

With Oracle, your mileage may vary