you need a where clause on that select statement, so that you get the
ONE row in that table that you want.
and remove the nowait. Nowait tells Oracle to continue processing the
next statement even if you didn't get the lock you wanted... Of course
removing it has it's own drawbacks, you could be hung waiting for
someone else to release the lock.
- Stefan Jakobsson <stefan_at_areldata.se> wrote:
> There are more rows in that table.
>
> It's one that we use for storing sequential numbers we use... like
> invoice
> numbers, membership numbers etcetc
>
> So we have to lock row when using it, so noone else uses the same
> number
> when we add a new member or
> create a new invoice...
>
> But good advice tho, and I would have used lock on it if not for the
> fact
> that we have to use row locking
> on it...
>
> /Stefan
>
> > -----Ursprungligt meddelande-----
> > Från: Rachel Carmichael [mailto:wisernet100_at_yahoo.com]
> > Skickat: den 25 januari 2002 15:00
> > Till: Multiple recipients of list ORACLE-L
> > Ämne: Re: Hmmmmm
> >
> >
> > is there only one row in that table? if so, you can lock the table
> > itself.
> >
> > try it without the nowait...
> >
> >
> >
> > --- Stefan Jakobsson <stefan_at_areldata.se> wrote:
> > > Having a small problem I need some help with...
> > >
> > > The problem is trying to lock a row on a parameter table for an
> > > application.
> > >
> > > The thing we need to do is following:
> > >
> > > Read the value in one row. LOCK that row for other users,
> increase
> > > the value
> > > with one
> > > update the row with the new value and release if for access to
> other
> > > users.
> > >
> > > We are trying to use the following SQL statement.
> > >
> > > SELECT medlnr FROM parametrar FOR UPDATE OF medlnr NOWAIT;
> > >
> > > But the thing is that when we try, anyone can head on in and
> select
> > > the same
> > > value
> > > and even make an update of that row...
> > >
> > > What am I missing here?
> > >
> > > Regards,
> > > Stefan Jakobsson
> > > Programmer
> > > Arel-Data
> > > --
> > > Please see the official ORACLE-L FAQ: http://www.orafaq.com
> > > --
> > > Author: Stefan Jakobsson
> > > INET: stefan_at_areldata.se
> > >
> > > Fat City Network Services -- (858) 538-5051 FAX: (858)
> 538-5051
> > > San Diego, California -- Public Internet access / Mailing
> > > Lists
> > >
> --------------------------------------------------------------------
> > > To REMOVE yourself from this mailing list, send an E-Mail message
> > > to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and
> in
> > > the message BODY, include a line containing: UNSUB ORACLE-L
> > > (or the name of mailing list you want to be removed from). You
> may
> > > also send the HELP command for other information (like
> subscribing).
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Great stuff seeking new owners in Yahoo! Auctions!
> > http://auctions.yahoo.com
> > --
> > Please see the official ORACLE-L FAQ: http://www.orafaq.com
> > --
> > Author: Rachel Carmichael
> > INET: wisernet100_at_yahoo.com
> >
> > Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> > San Diego, California -- Public Internet access / Mailing
> Lists
> >
> --------------------------------------------------------------------
> > To REMOVE yourself from this mailing list, send an E-Mail message
> > to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> > the message BODY, include a line containing: UNSUB ORACLE-L
> > (or the name of mailing list you want to be removed from). You may
> > also send the HELP command for other information (like
> subscribing).
> >
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Stefan Jakobsson
> INET: stefan_at_areldata.se
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing
> Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Rachel Carmichael
INET: wisernet100_at_yahoo.com
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
Received on Fri Jan 25 2002 - 10:15:07 CST