Subject delete all but the newest 'n' - more efficient way
Author Nick Upson
This works but I want/need something more efficient, the table
TBLCONNECTIOLOG can be very large (say 1, 000, 000) records and this
process could need to delete 95%.

connectionlogid is the PK, generator supplied on insert

This is the SP I have.

select maxrecordcount from TBLSYSTEM into :maxrecordcount;

select first 1 skip (:maxrecordcount) connectionlogid
from TBLCONNECTIONLOG order by OCCURREDAT desc into :id;

delete from TBLCONNECTIONLOG where connectionlogid < :id;