Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Autonumber Field in Oracle
"Chris Capson" <capsoncc_at_nbnet.nb.ca> schrijfbewerkingen: > I am currently migrating a Microsft Access 97 application to Oracle. I have
> created all of my tables but i can't figure out how to handle the autonumber
> field from Microsoft access. This autonumber field should automatically
> increment by one anytime anybody inserts a record into the table. I have
> been reading about it and it sounds like Oracle has some sort of CREATE
> SEQUENTIAL. I am note sure how to set it up so that anytime a record is
> added that the primary key field will be incremented automatically. If
> anybody has any recommendations or examples they would be greatly
> appreciated.
>
> Thanks
> Chris Capson
>
First create the sequence something like:
Create Sequence MySequence
increment by 1
start with 1;
(there's more, but this is a basic sequence, check your manual for details)
Now you can: Insert into MyTable values (MySequence.nextvalue,...);
Pretty easy huh ? ;-)
Regards,
Martin Received on Tue Feb 02 1999 - 02:45:39 CST