From: E.Havelaar@Regy.Canterbury.Ac.NZ (Ed Havelaar)
Subject: Generating unique numbers
Date: 1995/12/11 [thread overview]
Message-ID: <4aic03$3u1@cantua.canterbury.ac.nz> (raw)
We have an RdB database on top of VAX VMS (soon to migrate to Alpha) for which
I need to generate a unique account number whenever I create a new record. I
wonder if anyone has any experience on what the best way to do this is.
Options that have crossed my mind are:
[1] Write some SQL procedure which grabs MAX(ACC_NO), adds 1, and inserts a
record using this value as its new ACC_NO. Presumably locking / re-entrancy
problems could be taken care of by using the right type of transaction -- my
guess:
set transaction read write wait reserving <table> for exclusive write;
I am worried that (a) this will not be very fast and (b) I may already have a
transaction open, (e.g. a read-only transaction on a different table) which I
don't want to commit just yet.
[2] Store the next available number in a file, and allow the RMS services to
handle the locking problems. This makes it hard for something like SQL
services on a remote machine to use.
[3] Volatile memory with some fancy semaphore mechanism. Nice and fast, but
disastrous after a reboot, and of course, not accessible from another node let
alone a PC.
Any recommendations?
- Ed.
______________________________________________________________________
Eduard E Havelaar | The fool says in his heart,
Information Services Section | "there is no God"...
University of Canterbury |
Christchurch, New Zealand | - Psalm 14:1
next reply other threads:[~1995-12-11 5:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-12-11 5:00 Ed Havelaar [this message]
1995-12-12 5:00 ` Generating unique numbers Lilian Hobbs
1995-12-14 5:00 ` Albert Godfrind
1995-12-13 5:00 ` Stephen Hoffman
1995-12-14 5:00 ` Generating unique numbers, etc Ed Havelaar
1995-12-14 5:00 ` Norm Lastovica
1995-12-15 5:00 ` Lilian Hobbs
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox