What if I use simple Select statement to get the record and simple update statement bases on the primary key to update the flag column ?
As long as you do this in one transaction, and use the
for update clause, you will be the only one that can modify the record.
When you use the
for update clause, Oracle will tak e are that you will get a write lock on the data. Other people are able to read the data. But they can't do a
select for update, and they can't alter the record until you end the transaction.
You can Google for 'Pessimistic locking' to get more info on this (troublesome) topic.