Truncate while Inserting

Advertisement
This is a general question, but specific to Oracle as well.
1. What happens if I truncate a table which is being inserted into?
a. Will I be able to truncate it ?
b. What if the other process has the table locked?
c. What happens if I issue a truncate command and then another process starts to insert data into this table?
d. Do I have to exclusively lock a table used by multiple processes in order to truncate it so that a,b,c do not occur?
thanks
Advertisement

Replay

1. What happens if I truncate a table which is being inserted into?
r.- if the table is not completely unlock you will not be able to perform the truncate. In other words, if the insert comes first you will not be able to truncate the table until that insert be committed and if the insert comes when the truncate is gettting processed the insert fails. when you are carrying out a truncate the table takes an exclusive lock of its complete structure.
Joel PĂ©rez
http://otn.oracle.com/experts