Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to add / remove a lock from a table?
Thanks Zoran,
How about if you want to lock a row on a table? I am creating sequences manually and I need to make sure the user gets the next sequence value before a new one has been generated.
Thanks in advance,
Nick
Zoran Marjanski wrote:
> Use the LOCK TABLE sql statement. Look it up in the SQL Reference manual.
> Use COMMIT or ROLLBACK to unlock the table lock.
>
> But this LOCKS the entire table. If that's what you want good. Most of the
> time, the builtin row level locking is sufficient.
>
> The Oracle DB provides row level locking when updates are performed. There's
> no need to explicitly lock rows, usually. An UPDATE sql statement
> automatically locks rows that are being updated, until a COMMIT or ROLLBACK
> is performed. While your SQL session has rows locked for update, other SQL
> sessions, see the old values of the data, until you COMMIT. This is read
> consistency. Most modern SQL databases provide this and is nothing new.
>
> Hope this helps.
>
> Zoran.
>
> "Nick Tentomas" <Ntentoma_at_CSBFACMGT.CSBFM.DAL.CA> wrote in message
> news:3AB8C78D.E5C22DCA_at_CSBFACMGT.CSBFM.DAL.CA...
> > Hello,
> >
> > I am very new to Oracle so I might be asking something very simple. I
> > was wondering if anybody know how to set a lock for read/write on a
> > table and when I finish how to remove the lock.
> >
> > Thanks in advance,
> >
> > Nick
> >
Received on Fri Mar 23 2001 - 09:58:24 CST
![]() |
![]() |