Subject Re: [ib-support] Idea for a new field type for FB 2,0 or IB 7?
Author Andreas Pohl

there are two possibilities to get next invoice number:
- within transaction control by selecting max(nr)
- outside transaction control by using generator value

Both ways will fail in case of rollback transaction. Generator value cannot be set back safely in a multi user environment.

Max(nr) or next_ nr_procedure will provide different results if more then one user is creating invoices and something goes wrong between calling trigger/statement for calculating invoice nr and closing transaction.

Maybe you are a lucky men and there is only a small time frame between posting values and closing transaction, but in WANs or slow LANs...

So to be sure generation of unique and sequential invoice or whatever number must be provided in own transaction context. That's what Jason meant.

Mit freundlichem Gruss & Best Regards

Andreas Pohl

> I don't know what you mean by a second phase. Perhaps if I explain what I'm
> doing in detail, you can explain to me what you see wrong with it: