Subject Re: [firebird-support] Re: Best way to check a value
Author Paul Vinkenoog
Hi Paco,

>> Is NUM supposed to be some kind of record ID? Then I suggest you
>> make it the PK and feed it from a generator:

> NUM is a numeration doc/form.
> The problem with a generator is that if the insert fails, i will
> lost the generator value. I donĀ“t want to loose this value.

Why not? If you're filling gaps the way you do in your trigger, they
won't be in the right order anyway.

If you just need uniqueness, don't worry about the gaps - you won't
run out of numbers that quickly! :-)

If you _really_ can't have gaps (this could be the case e.g. for
invoice numbers), there are methods to achieve this, but they take
some time setting up. Here's a document you should read:

http://www.ibobjects.com/docs/ti_AuditableSeries.ZIP

Your current trigger is not bullet-proof in a multi-user environment.


Greetings,
Paul Vinkenoog