Subject Re: Generators, revisited
Author Svein Erling Tysvær
Hi Kevin!

So you are doing a GEN_ID(<generator>, <number of records>) and then
use the numbers from the returned value and <number of records> - 1
forward? Well, this should be safe, except for the following cases:

* <number of records> is a negative number or 0.
* you use a number higher than <generated value> + <number of records>
- 1 records.
* you use the same value twice

Of course, you do have the standard reasons for trouble as well, i.e.
someone using a number without calling the generator or using SET
GENERATOR to decrease the value.

Could any of these be applicable to your case?

Set

--- In firebird-support@yahoogroups.com, Kevin Stanton wrote:
> Thanks Helen, I'm in the hunt for the evil code and I've also
> downloaded the demo app from IBO that you mentioned in your book
> (thank you for the book!).
>
> The only reason why I'm getting the generator value via a query is
> each user wants to have sequential numbers for their own batch of
> invoices. So I go and retrieve x number of invoices, thus the step
> in retrieving the generator value.
>
> Kevin