Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: [Newbie] Serial Keys - How to implement
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