Subject | Re: [firebird-support] Re: Sequential auto incremental numbering |
---|---|
Author | Helen Borrie |
Post date | 2018-09-03T09:34:19Z |
Lester wrote:
http://www.ibobjects.com/docs/ti_AuditableSeries.ZIP
I wrote it. It was a long time ago but it still applies. The thing
about generators is not that you can't rely on uniqueness (you
absolutely can!) but that you can't go back and *reuse* a number if your
transaction is rolled back for some reason. Back then, accountants
used to insist that accounting documents have unique numbers *in an
unbroken sequence*. Some countries still require this, so this
article will help you if you are stuck with this limitation.
But definitely, the moment you start meddling with the values of
generators, you are making a bed of nails. Incidentally, there *are*
ways to turn back generators so, theoretically, you could "re-use" a
missing value. In practice, you must not try to.
Helen
---
This email has been checked for viruses by AVG.
https://www.avg.com
> On 03/09/18 07:29, 'Christian Giesen' chris@... [firebird-support]I think this is the article Lester was referring to:
> wrote:
>> NextInvNo = (SELECT MAX(INVOICE_NO) FROM INVOICE) + 1;
> Christian ... there was many years ago a very nice article on this very
> problem.
http://www.ibobjects.com/docs/ti_AuditableSeries.ZIP
I wrote it. It was a long time ago but it still applies. The thing
about generators is not that you can't rely on uniqueness (you
absolutely can!) but that you can't go back and *reuse* a number if your
transaction is rolled back for some reason. Back then, accountants
used to insist that accounting documents have unique numbers *in an
unbroken sequence*. Some countries still require this, so this
article will help you if you are stuck with this limitation.
But definitely, the moment you start meddling with the values of
generators, you are making a bed of nails. Incidentally, there *are*
ways to turn back generators so, theoretically, you could "re-use" a
missing value. In practice, you must not try to.
Helen
---
This email has been checked for viruses by AVG.
https://www.avg.com