Re: How to generate unique document number ?
- From: "frank.van.bortel@xxxxxxxxx" <frank.van.bortel@xxxxxxxxx>
- Date: 13 Sep 2006 00:44:16 -0700
krislioe@xxxxxxxxx schreef:
Hi All,
We need to generate Document Number where there should be any gap, so
that we cannot use sequence. For example : Invoice Number.
Why not? Do not use the cache on a sequence. It will minimise
the risk of "loosing" numbers due to shutdown. However, there's
no always the possibility of a user that decides to rollback the
transaction, or an error may occur, causing the transaction to
be rolled back.
one possible approach like : Select MAX(InvoiceNumber)+1 from invoice,
what if that table has millions of rows, is this reliable enough ?
Reliable - in what way? There's not one way you would
be able to ensure you will not be missing numbers, AND
have a scalable solution.
How to avoid two user do the same query at same time that lead to
dupplicate number ?
By locking the table - as I said: no way it's going to scale.
By creating an autonomous transaction - still possible to
get missing numbers.
Bottom line: use a sequence, and explain some numbers
may be missing - write to a "missing" table as soon as
the number gets issued, and remove when the transaction
completes. Make the write to your "missing" table
an autonomous transaction
.
- Follow-Ups:
- Re: How to generate unique document number ?
- From: Mark D Powell
- Re: How to generate unique document number ?
- References:
- How to generate unique document number ?
- From: krislioe
- How to generate unique document number ?
- Prev by Date: How's your shared server doing?
- Next by Date: Re: fooling EM setup into using a different host name
- Previous by thread: Re: How to generate unique document number ?
- Next by thread: Re: How to generate unique document number ?
- Index(es):
Relevant Pages
|
Loading