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

Home -> Community -> Usenet -> c.d.o.misc -> HELP: Sequences and primary keys beginner question.

HELP: Sequences and primary keys beginner question.

From: s <asdg_at_sdf.lkj>
Date: 1997/06/21
Message-ID: <5of715$22l@news9.noc.netcom.net>#1/1

Hi,

        I realize that this question must have been asked many times. However, I have looked at all the FAQ pages I can find and have looked through many manuals for many hours with no luck, so I turn to you.

        I want to use a sequence to create the next number for a primary key field. All the manuals indicate that this is 'easy' or 'convenient', but none of them tell me how.

        I know that I cannot make reference to the sequence's NEXTVAL in the DEFAULT column in the CREATE TABLE command (though this amazes me).

        I know how to write a trigger that will fire on an INSERT statement and populate the keyed field with the NEXTVAL. I know that I can also include the NEXTVAL in every insert command I ever perform against a table.

        I just can't believe that I have to do this for every table that I want to have an autoincrementing primary key! There's got to be a better way, this just seems incredibly laborious.

        Any help would be greatly appreciated. Please reply to my email address below (after modification).

Thank you,

        
        


________________________________________________
Ben Harmon
ben_at_dascom.com.nospam
**Please remove .nospam suffix if you want to mail me**
Received on Sat Jun 21 1997 - 00:00:00 CDT

Original text of this message

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