I want to do rollback from insert data into master-details table when there
are duplicate ID key in by user. The algorithm is like this
1. insert data into master_table
2. loop
3. select count(*) from detail where ID = <ID key in by user>
4. if count(*) > 0{ $dup = true;}//end if
5. insert data into detail_table
6. End loop
7. If $dup = true{OCIRollbac k($conn);}
else{OCICommit( $conn);}
if there are two duplicate row inserted into detail_table, it should
rollback all transaction but I found that it won't work and still insert
on record to it.
Please advise on this problem, thanks.
are duplicate ID key in by user. The algorithm is like this
1. insert data into master_table
2. loop
3. select count(*) from detail where ID = <ID key in by user>
4. if count(*) > 0{ $dup = true;}//end if
5. insert data into detail_table
6. End loop
7. If $dup = true{OCIRollbac k($conn);}
else{OCICommit( $conn);}
if there are two duplicate row inserted into detail_table, it should
rollback all transaction but I found that it won't work and still insert
on record to it.
Please advise on this problem, thanks.
Comment