I do not quite agree with DCookie.
Session IF Inserts the value "blue" (which is forcibly unique), and then session B inserts the value "blue", session B will wait for a lock from session A. If session A ends, then session B will receive a restriction violation. if session A rolls back, then session B will be allowed to continue.
There is potentially very little opportunity for session A to insert a row and commit it, session B to get a constraint violation, and then the row that needs to be deleted before session B gets an update. I would appreciate it very unlikely.
First, I'll see if there is only one unique constraint in the target_total table. If not, you want to be sure which restriction is causing the violation. Also check for unique indexes as well as restrictions.
Check for any discrepancy between the data type or the interfering trigger. NUMBER (2.0) may not match the numerical value 1.1 in the match selection, but when pasted, the value 1.1 will be truncated to 1.0, which may violate the constraint. In my example, if the trigger fired the capital letter “BLUE”, then the choice may not match the “blue”, the insertion may fail on the duplicated key in “BLUE”, and the subsequent insertion also does not match “blue”.
Then check to see if variable name naming exists. In INSERT .... VALUES (identifier), then the identifier must be a PL / SQL variable. However, the table is SELECT * FROM WHERE column = identifier, then the identifier may be the name of the column, not the PL / SQL variable. If there is a column name or accountId function, this will take precedence over the PL / SQL variable with the same name. It's a good habit to prefix PL / SQL variables to ensure that such a namespace conflict never occurs.
My only other idea is that since you are using multithreading, is there any potential for thread conflicts. This may be more likely in a live environment where threads can hit locks from other sessions. This can make them synchronize in an odd way, which does not occur during testing.