DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Row Level Lock, can you force one without ...

  1. #1
    Join Date
    Oct 2000
    Posts
    103

    Question

    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

  2. #2
    Join Date
    Aug 2000
    Posts
    17
    SELECT ...
    FROM ...
    FOR UPDATE;

    This select statement does a row level lock.

    Roger

  3. #3
    Join Date
    Oct 2000
    Posts
    103
    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

  4. #4
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    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.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width