Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Re[3]: How do you generate primary keys?

RE: Re[3]: How do you generate primary keys?

From: Reardon, Bruce (CALBBAY) <Bruce.Reardon_at_comalco.riotinto.com.au>
Date: Thu, 06 Nov 2003 14:49:25 -0800
Message-ID: <F001.005D5DD6.20031106144925@fatcity.com>


And to reply to my own message - the flaw is rollbacks I guess you could use a savepoint after the sequence number, and if you want to "undo" the transaction put the record in an unused record history table, but all very messy.

Bruce Reardon
NOTICE: This e-mail and any attachments are private and confidential and may contain legally privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments. This notice should not be removed.

-----Original Message-----
Sent: Friday, 7 November 2003 8:34 AM
To: Multiple recipients of list ORACLE-L

Haven't tried this but how does this sound:

Use a sequence
cache it - to allow scalability
pin it so it doesn't age out of the cache have a shutdown trigger make the sequence nocache so don't lose values on a clean shutdown That leaves instance crashes and shutdown aborts to worry about So, create a startup trigger that resets the current value of all sequences to the next correct value For speed, the shutdown trigger could leave a flag somewhere so that the startup trigger only tried to process if it needed to

There's probably flaws in this so certainly test, test and test.

HTH,
Bruce Reardon
NOTICE: This e-mail and any attachments are private and confidential and may contain legally privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments. This notice should not be removed.

-----Original Message-----
Sent: Friday, 7 November 2003 1:15 AM
To: Multiple recipients of list ORACLE-L

Wednesday, November 5, 2003, 1:14:26 PM, Jamadagni, Rajendra (Rajendra.Jamadagni_at_espn.com) wrote: JR> hypothetically, When you have a requirement that no gaps allowed in a sequence no matter what, JR> would you still use sequences?

Ah! This is a good question. If no gaps are acceptable, period, end of story, then what is a viable solution? I do not think sequences are it.

Best regards,

Jonathan Gennick --- Brighten the corner where you are
--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Reardon, Bruce (CALBBAY)
  INET: Bruce.Reardon_at_comalco.riotinto.com.au

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Nov 06 2003 - 16:49:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US