WHILE 1 = 1
LOOP
EXECUTE IMMEDIATE 'delete from '
|| p_tablename
|| ' where '
|| p_condition
|| ' and rownum <= :rn'
USING p_count;
IF SQL%NOTFOUND
THEN
EXIT;
ELSE
n_delete := n_delete + SQL%ROWCOUNT;
END IF;
COMMIT;
END LOOP;