Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Lock record

Re: Lock record

From: Arnaud B. <balaya_at_club-internet.fr>
Date: Wed, 1 Aug 2001 18:12:09 +0200
Message-ID: <9k9a3u$hho$1@front6m.grolier.fr>

> Answer embedded but one question:
> why don't you use sequences?

Because I haven't build the DB, I am just using it.

> > Hi,
> >
> > This is surely a commun question, but I can't get any answer.
> > A table on my DB contains all counters. One record of this table
 contains
> > the current order number. What is the correct way to use and change the
> > current order number ?
> > Is this correct :
> > -Lock the record (How ?)
> > -Read the current order number
>
> 2 first steps in one statement:
> select name, value from counters where name='<my counter>' for update of
value;

I guess "for update of value" will lock the record. Does it lock it until the commit appens or do we need to have the update first.

What happens if an error occurs between those statement ? Will the record stay locked ?

>
> > -Write the next one
>
> update counters set value=value+1 where name='<my counter>';
>
> > -Unlock the record (How ?)
>
> commit;
>
> > -Use the read order number to add a new order

Where can I get help file about this ? online help ?

Thanks for your help

Arnaud Received on Wed Aug 01 2001 - 11:12:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US