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: [Newbie] Serial Keys - How to implement

Re: [Newbie] Serial Keys - How to implement

From: Mattias Malmgren <a2matmal_at_ulmo.stud.slu.se>
Date: Wed, 24 Jun 1998 09:33:40 +0200
Message-ID: <3590ABD4.A1282DD8@ulmo.stud.slu.se>


Hello!

In Oracle 8 there is something called sequences. Sequence number generation is useful to generate unique primary keys for your data automatically.

CREATE SEQUENCE customer_seq

And then it can be used like this:

INSERT INTO customer (customer, name)
VALUES (customer_seq.NEXTVAL, 'Mattias');

Each time customer_seq.NEXTVAL is called 1 will be added to the sequence.

Greetings / Mattias

David C. Harrison wrote:

> How do I make a statement like this:
>
> INSERT INTO customer
> VALUES (0, 'Baney Rubble');
>
> auto increment the value of the primary key?
>
Received on Wed Jun 24 1998 - 02:33:40 CDT

Original text of this message

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