I had a problem with a query in oracle 10g database when two users launch a process at the same time. This query is inserting volume data from another table.
I tried to simplify the example:
Tables structure:
Table 1 VAL1 | VAL2
Table 2 ID | VAL1 | VAL2
Query:
Insert into Table2 (id, VAL1,VAL2)
select t2.id + rownum, t1.VAL1, t1.VAL2
from Table1 t1, (select max(id) as id from table2) t2
problem description:
User1 launch the process, the query will insert 50000 record with id from 1 to 50000
User2 launch the process at the same time, select max(id) as id from table2 will not return the expected value which is 50000 as the rows inserted by user1 are not yet committed so the system will try to insert rows with the same Id.
Seems that oracle do not allow dirty reads like sql server or DB2, is there any way to allow reads from uncommitted rows? or another alternative for this?