by jethrow » 17 Mar 2014, 09:48
Thanks for the input, but that will not satisfy my request. This is an automated process in production, so I cannot just execute a delete statement as such - since there could be millions+ of deletes - which could bog down the server. That's why I'm attempting to create a commit threshold.
The following works:
Code: Select all
delete from <TABLE_NAME>
where (<KEY>) in (
select <KEY> from <TABLE_NAME>
where <CONDITION>
FETCH first <N> rows only )
The problem with this, however, is there is a limit not only on the IN-statement, but there's also a Lock limit. Again, my goal is to create a generic SQL statement to consolidate code for a purge process on multiple tables.
Thanks for the input, but that will not satisfy my request. This is an automated process in production, so I cannot just execute a delete statement as such - since there could be millions+ of deletes - which could bog down the server. That's why I'm attempting to create a commit threshold.
The following works:
[code=SQL]delete from <TABLE_NAME>
where (<KEY>) in (
select <KEY> from <TABLE_NAME>
where <CONDITION>
FETCH first <N> rows only )[/code]
The problem with this, however, is there is a limit not only on the IN-statement, but there's also a Lock limit. Again, my goal is to create a generic SQL statement to consolidate code for a purge process on multiple tables.