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: How do you generate primary keys?

RE: How do you generate primary keys?

From: TOMPKINS, MARGARET <MARGARET.TOMPKINS_at_dfas.mil>
Date: Wed, 05 Nov 2003 05:29:24 -0800
Message-ID: <F001.005D5A8E.20031105052924@fatcity.com>


I take the easy approach. I use Oracle Designer and when I transform an entity to get a table, I check the checkbox that indicates "surrogate key". It automatically gives me a sequence generated surrogate primary key. The name of the sequence by default is the table alias followed by "_SEQ" so it all matches up nicely. When I'm ready, I generate the DDL and it all gets generated neatly and correctly.

   BTW, when I transform the entity, if I've got a primary unique identifier on the entity then I get a unique key automatically along with my sequence generated surrogate primary key. It's a great way to do it and very easy!

Respectfully,
> Maggie Tompkins - CAD SQA
> Corporate Applications Division
> Technology Services Organization - Kansas City
> Defense Finance and Accounting Service
> 816-926-1117 (DSN 465); Margaret.Tompkins_at_dfas.mil
>

-----Original Message-----
Sent: Wednesday, November 05, 2003 7:19 AM To: Multiple recipients of list ORACLE-L

The recent article that mentioned sequences got me to thinking. I might pitch a more detailed article on sequences to Builder.com. But a more interesting article might be one that explored various ways to automatically generate primary keys. So, in the name of research, let me throw out the following questions:

What mechanisms have you used to generate primary keys? Which ones worked well, and why? Which mechanisms worked poorly?

I've run up against the following approaches:

The SYS_GUID approach is interesting, but if you need an ID number that users will see, and that users might type in themselves (e.g. social security number), is SYS_GUID really all that viable?

Best regards,

Jonathan Gennick --- Brighten the corner where you are http://Gennick.com * 906.387.1698 * mailto:jonathan@gennick.com

Join the Oracle-article list and receive one article on Oracle technologies per month by email. To join, visit http://four.pairlist.net/mailman/listinfo/oracle-article, or send email to Oracle-article-request_at_gennick.com and include the word "subscribe" in either the subject or body.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Jonathan Gennick
  INET: jonathan_at_gennick.com

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).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: TOMPKINS, MARGARET
  INET: MARGARET.TOMPKINS_at_DFAS.MIL

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 Wed Nov 05 2003 - 07:29:24 CST

Original text of this message

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