Note how no commit was done in between each statement. Could this cause a table lock or blocked session?
delete from tableblah;
insert into tableblah
(select * from othertable);
|
|
In Oracle, writers don't block readers, and it won't lock the table, just the affected rows. Until you commit, all other sessions will continue to see the data as it was before your delete, and can continue to query. The only blocking you'd see in another writer session is if there is a primary key or unique index on the table and it tries to insert a row which clashes; or it tries to update/delete a row that you deleted. That second session will wait until your first session issues a commit or rollback; the second session will then either get an error (if you committed) or complete the action (if you rolled back). |
|||||
|