Home » SQL & PL/SQL » SQL & PL/SQL » how can i lock particular row in a table
how can i lock particular row in a table [message #561182] Thu, 19 July 2012 05:49 Go to next message
priteshranjan.preet
Messages: 131
Registered: April 2012
Location: delhi
Senior Member
hi experts how one can lock a particular row in a table.for example i have a employee table in which 50 records. now i want to lock only 10 records of the employee table. how can i do it please suggest me,

thanks & regards
pritesh ranjan
Re: how can i lock particular row in a table [message #561183 is a reply to message #561182] Thu, 19 July 2012 06:00 Go to previous messageGo to next message
gazzag
Messages: 267
Registered: November 2010
Location: Bristol, UK
Senior Member
Why?
Re: how can i lock particular row in a table [message #561184 is a reply to message #561183] Thu, 19 July 2012 06:01 Go to previous messageGo to next message
Littlefoot
Messages: 18833
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
SELECT ... FOR UPDATE might do that.
Re: how can i lock particular row in a table [message #561204 is a reply to message #561184] Thu, 19 July 2012 08:35 Go to previous messageGo to next message
priteshranjan.preet
Messages: 131
Registered: April 2012
Location: delhi
Senior Member
can u tell me proper syntax or any link.

thanks & regards
pritesh ranjan
Re: how can i lock particular row in a table [message #561205 is a reply to message #561204] Thu, 19 July 2012 08:38 Go to previous messageGo to next message
BlackSwan
Messages: 21955
Registered: January 2009
Senior Member
>can u tell me proper syntax or any link.

SQL Reference manual


Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: how can i lock particular row in a table [message #561206 is a reply to message #561205] Thu, 19 July 2012 08:51 Go to previous messageGo to next message
muralikri
Messages: 638
Registered: August 2011
Location: chennai
Senior Member

First 10 records will be lock..
select * from emp where rownum<=10 for update 
Re: how can i lock particular row in a table [message #561210 is a reply to message #561206] Thu, 19 July 2012 09:29 Go to previous messageGo to next message
BlackSwan
Messages: 21955
Registered: January 2009
Senior Member
>First 10 records will be lock..
NO, random 10 records will be locked.
Re: how can i lock particular row in a table [message #561216 is a reply to message #561210] Thu, 19 July 2012 09:42 Go to previous messageGo to next message
muralikri
Messages: 638
Registered: August 2011
Location: chennai
Senior Member

Can you expalin how it will be?
Re: how can i lock particular row in a table [message #561219 is a reply to message #561216] Thu, 19 July 2012 09:46 Go to previous message
BlackSwan
Messages: 21955
Registered: January 2009
Senior Member
>Can you expalin how it will be?
select * from emp
above has NO control over which rows or the order of the rows returned by SELECT.

Rows in a Heap table are like balls in a basket.
Which 10 balls (say out of 10000) are the first ten in this basket.
Previous Topic: 2nd Decimal Place not appearing
Next Topic: building a pl/sql query from select statement
Goto Forum:
  


Current Time: Sun Apr 20 19:08:27 CDT 2014

Total time taken to generate the page: 0.10703 seconds