On Tue, Jul 05, 2005 at 13:47:24 +0200, Zac <zaccheob@inwind.it> wrote:
> I think you should use 'FOR UPDATE' clause in your first "select":
>
> select into vnrBon maxnrbon+1 from MagMaxNrBon where magazie =
> dsgroup.magazie_implicita_lansare FOR UPDATE;
>
> In this way you lock the rows eventually returned and no one can update
> them (or select them "for update") until your transaction finished.
That doesn't work because you don't lock rows which aren't in the table
yet. You need to use a lock table instead.