I've been looking for something like this for quite some time, but instead of using identity column, we are using sequences, how can this be achieved with sequences?
It's a little bit more complicated, but if the names of your sequences can be derived from your table names then you simply have to look at the max id in the table and update your sequence accordingly.