Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Lock record
Answer embedded but one question:
why don't you use sequences?
-- Have a nice day Michel "Arnaud BALAY" <arnaud_at_europrint.fr> a écrit dans le message news: 9k8f4l$1ip$1_at_front7m.grolier.fr...Received on Wed Aug 01 2001 - 05:43:43 CDT
> 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;
> -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
>
> Thanks for your help.
>
> Arnaud
>
>