How to prevent inserting into table while extraction is happening from same table?
Asked
Active
Viewed 59 times
-1
-
2You need to add more information to your question, otherwise it will be closed. See [How to Ask](https://stackoverflow.com/help/how-to-ask). You need to edit your tags as well, is this SQL Server (tsql) or Oracle (plsql)? – Tony Jul 30 '19 at 19:32
-
Possible duplicate of [SQL Server - How to lock a table until a stored procedure finishes](https://stackoverflow.com/questions/3662766/sql-server-how-to-lock-a-table-until-a-stored-procedure-finishes) – Tony Jul 30 '19 at 19:38
1 Answers
1
Oracle guarantees that the set of data you read during a transaction stays the same, as it would be at the beginning of the transaction. So your extraction of data never is disturbed by inserts, if you do the extraction during one transaction.
I think Microsoft SQL-Server has a similar mode.
Therefore: Do the complete extraction in one transaction.

aschoerk
- 3,333
- 2
- 15
- 29