Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Generating unique numbers
@ 1995-12-11  5:00 Ed Havelaar
  1995-12-12  5:00 ` Lilian Hobbs
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Ed Havelaar @ 1995-12-11  5:00 UTC (permalink / 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




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1995-12-15  5:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-12-11  5:00 Generating unique numbers Ed Havelaar
1995-12-12  5:00 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox