Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: I am a moron -- how do I automatically increment a primary key field?
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.
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