Click to See Complete Forum and Search --> : Row Level Lock, can you force one without ...


supermega
08-10-2001, 03:46 PM
Row Level Lock, can you force one without updating a row, is there a way to lock a row that is just being viewed(selected) in the app?

SMD

roger
08-10-2001, 07:39 PM
SELECT ...
FROM ...
FOR UPDATE;

This select statement does a row level lock.

Roger

supermega
08-13-2001, 04:12 PM
in my testing this locks the whole table
I only want to lock the specific row that I am looking at.
Is there a way to do this?

SM

jmodic
08-13-2001, 06:11 PM
Originally posted by supermega
in my testing this locks the whole table
I only want to lock the specific row that I am looking at.
Is there a way to do this?

SM
If you don't use any WHERE predicate in your SELECT FOR UPDATE, then of course all rows in a table will be locked (but this still doesn't mean the table is locked, it is very different as to ALTER TABLE LOCK command).

SELECT * FROM dept WHERE deptno = 10 FOR UPDATE; will lock only one row in a table.