In my procedure, I need first to run a merge table T using table S and then truncate table S. And other session might insert data into the table S during my execution of the procedure. So I'd like to lock the table in exclusive mode for the whole
transaction, but how to do that?
If I only lock the table during the merge phase, if after merge completed but before truncate begin, another session inserted some data into it, then the data in S will be missing when run the procedure again.
merge T using S .....
truncate table S;
View Complete Post