your question should have peen posted to the "Oracle development" forum, but anyway ... since I do not know how you identify the latest generated transactions, here is a request that will give you the max(ID) for all the transaction_ids, you just have to add some things in the where clause of the transaction ...

select a.transaction_id, a.id
from table a
where a.id =
(select max b.id from table b
where a.transaction_id=b.transaction_id)