Subject Re: [firebird-support] How to hold lock on record
Author Ann W. Harrison
At 12:16 PM 10/29/2004, =?ISO-8859-2?Q?Bogus=B3aw_Brandys?= wrote:

>Sorry , I didn't mention that this question is related to my previous
>question about unbroken series of document numbers wrapped monthly.

The most frequently used solution in this case is to insert a document
with a null number, using an artificial primary key. Commit that.
Then in a single short transaction, generate your document number and
update the document to have the new number. That will requires a
scavenge program that runs from time to time, finding documents without
numbers and asking their creators whether the document is still valid.

Alternately, you can create a number, and store a null document under
that number with enough information to identify the person who created
it and the time of creation. Then you need a scavenge program that
finds numbers without documents.