I am doing insertion into a Oracle table using batchUpdate. Five different parallel threads are invoking batchUpdate method to insert into a single table. Table is of Global Temporary Table type.
Program execution is not completing, its getting stuck after establishing database connection.
Will multiple threads operating on a single global temporary table cause table lock and hold the execution of the program?
I can see the locked table using below query-
select object_name, object_type from all_objects where object_id in (select object_id from v$locked_object);
Yes they will.
If 2 different sessions are updating the same table at the same time, the second session will not be able to access the table until the first table is done updating(COMMIT executed). The first session actually deploys a 'LOCK' on that table until it is done updating.
You cannot really update exactly the same block of data by two threads at exactly the same time can you?
It's a ORACLE feature to maintain data consistency.