I have table user
with fields let say userid
,username
,email
,dob
, and i have to do CRUD operation on this table. I have done all the CRUD operations and everything is working perfectly fine. But it lacks one feature i.e. while a particular record is fetched by user for update other user can't do update,delete on it.
SELECT *
FROM USER
WHERE USERID=2
FOR UPDATE OF EMAIL NOWAIT;
I have this query but it seems not to be good approach because the lock is not released until the commit
is fired.
Is there any better approach for this problem.