Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: What is best way to AUTONUM primary key field?
Rick Roberts schrieb:
>
> Access makes it easy.
> How do you auto number the primary key field?
>
> Thanks,
>
> Rick Roberts
Hi Rick,
use sequenes and triggers.
Example:
Drop Sequence SEQ_TELEFONNUMMER_ID;
create Sequence SEQ_TELEFONNUMMER_ID;
drop trigger tBI_Telefonnummer;
create trigger tBI_Telefonnummer before INSERT on TELEFONNUMMERN for
each row
begin
Select SEQ_TELEFONNUMMER_ID.NEXTVAL into :new.ID from dual;
end;
/
HTH
Matthias
--
Matthias.Gresz_at_Privat.Post.DE
Always log on the bright side of life.
http://www.stone-dead.asn.au/movies/life-of-brian/brian-31.htm
Received on Tue Dec 22 1998 - 01:14:06 CST