Oracle Analytic Function
–USE ANALYTIC FUNCTION TO DELETE ALL BUT ORIGINAL delete from <TABLE_NAME> where (key1, ins_timestamp) in (select key1, ins_timestamp from ( select key1, ins_timestamp, upd_timestamp , row_number() over (partition by key1 order by ins_timestamp) as rownumber from <TABLE_NAME> ) t1 where …