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: How to mimic MS Access 'Auto-Increment' Column

Re: How to mimic MS Access 'Auto-Increment' Column

From: Tom Mettling <mettlingt_at_wtchen.com>
Date: 1997/06/13
Message-ID: <33A18D57.718B247C@wtchen.com>#1/1

Paul,

You are on the right track with the sequence idea. Create a sequence, and then write a trigger for the table:

create trigger autoincr
before insert on [tablename]
for each row
select tablename_sequence.nextval into :new.[fieldname] from dual;
end autoincr

Hope this helps.

Tom Mettling
W.T. Chen & Company, Inc.
mettlingt_at_wtchen.com

Paul Kilmer wrote:

> It is my task to replace the MS Access tables used in a small Call
> Tracking application with Oracle tables. The app is currently all in
> Access, using some VB code to manage inserts, updates, deletes. There
>
> are _no_ insert/update queries defined.
> Most of this task is very straightforward. However, a key column of
>
> one of the MS Access tables is defined as 'Auto-Increment'. Since
> there
> are no 'insert' Access queries defined in which I could have
> implemented
> the use of an Oracle sequence, I'm a little unsure of how to make this
>
> change.
> As I'm not an Access VB whiz, I'd be interested to hear any opinions
>
> or suggestions as to how you'd proceed.
>
> Regards,
> Paul
> ------------------------------
> Paul E. Kilmer
> Hershey Foods Corporation
> pkilmer_at_hersheys.com
> http://www.hersheys.com
> ------------------------------
Received on Fri Jun 13 1997 - 00:00:00 CDT

Original text of this message

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