I have three tables t1,t2,t3 and t4 where t3 is master table and t4 is detail table. I am inserting in t3 data selected from t1; inserting in t4 data selected from t2. Now, after comparing the totals of table t3 and t4; doing rollback or commit. Is this approach fine?
Select data from the tables first and perform comparison, then insert data. But this approach requires firing multiple select queries twice in case of correct comparison.