Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: What is best way to AUTONUM primary key field?

Re: What is best way to AUTONUM primary key field?

From: Matthias Gresz <GreMa_at_t-online.de>
Date: Tue, 22 Dec 1998 08:14:06 +0100
Message-ID: <367F46BE.640DEE98@Privat.Post.DE>

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

Original text of this message

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