You could post all block data to the db in a temp table, then run a procedure to check the data with joins, which will be orders of magnitude more efficient than your logic.
Then insert/delete/update in the final tables as per your business requirement, then re-query the block from db.
You'll have to rewrite pretty much all your logic but you'll have created a nice interface in PL/SQL that you will be able to reuse the day you drop Forms for something else.