My question is this:
How can I delete n rows from a table if they meet the condition x rows in total? Where x> > > > > n. I want to use it because I am going to have a job that runs at a certain time and if every time it is executed it will delete 100000000000 rows, it can slow down the DB and I want to set a limit of deletions per iteration.
This delete would be fulfilled by millions of records and I just want to delete an amount x. How do I do it?
DELETE trazabilidad_pedro WHERE cd_intercambio = rec_mon_borrado.cd_intercambio AND cd_estado NOT IN ('06','07','08','09','99');'