Xref: alice comp.databases.oracle.misc:25650
Path: alice!news-feed.fnsi.net!netnews.com!nntp.abs.net!ptdnetP!newsgate.ptd.net!newsfeed00.btx.dtag.de!newsmm00.btx.dtag.de!news.btx.dtag.de!not-for-mail
From: GreMa@t-online.de (Matthias Gresz)
Newsgroups: comp.databases.oracle.misc
Subject: Re: Autonumber Field in Oracle
Date: Tue, 02 Feb 1999 08:47:44 +0100
Lines: 37
Message-ID: <36B6ADA0.BAF44C86@Privat.Post.DE>
References: <795h63$i56$1@garnet.nbnet.nb.ca>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news05.btx.dtag.de 917943508 10273 0722193570-0001 990202 08:18:28
X-Complaints-To: abuse@t-online.de
X-Sender: 0722193570-0001@t-online.de
X-Mailer: Mozilla 4.5 [de] (Win95; I)
X-Accept-Language: de



Chris Capson schrieb:
> 
> 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.
> 

You've got to use SEQUENCES and TRIGGERS:

Create Sequence SEQ_DL_Honorar_ID;

create or replace trigger tBI_DL_Honorar before INSERT on DL_Honorar for
each row
begin
	SELECT SEQ_DL_Honorare_ID.NEXTVAL INTO :new.HonorarNr FROM DUAL;
end;
/



HTH
Matthias
-- 
Matthias.Gresz@Privat.Post.DE

Always log on the bright side of life.
http://www.stone-dead.asn.au/movies/life-of-brian/brian-31.htm


