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

Home -> Community -> Usenet -> c.d.o.server -> Re: I am a moron -- how do I automatically increment a primary key field?

Re: I am a moron -- how do I automatically increment a primary key field?

From: Andy Hassall <andy_at_andyh.co.uk>
Date: Fri, 20 Feb 2004 00:12:27 +0000
Message-ID: <tsja305fsth7lm5vr491fkde3alguqgqoq@4ax.com>


On Thu, 19 Feb 2004 15:43:16 -0800, Richard Crawford <rscrawford.penguin_at_mossroot.remove_waterfowl.com> wrote:

>How can I make sure that each record inserted into a table is given a
>unique primary key? I'm used to using MySQL which has an
>"auto_increment" feature so that I don't even have to worry about the
>primary key.
>
>I've Googled for this quite a bit and haven't found anything.

 Really? First hit of all the key words in your subject, with 'oracle' on the end, gives a workable answer from here anyway.

http://www.google.co.uk/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=automatically+increment+primary+key+field+oracle

 Basic idea is use a trigger and a sequence.

-- 
Andy Hassall <andy_at_andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Received on Thu Feb 19 2004 - 18:12:27 CST

Original text of this message

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