Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Equivalent of Access autonumber
Here is some trigger code that select's from sequence and populates ID
column of PROMO table.
CREATE OR REPLACE trigger promo_tr
BEFORE INSERT on promo
FOR EACH ROW
BEGIN
select promo_seq.nextval into :new.id from dual ;
Marin Dimitrov wrote:
>
> > Can Oracle have a autonumber like in Access?
>
> create a sequence and a "before insert" trigger for that table that will
> insert nextval from the sequence into the desired column
>
> hope this helps,
>
> Marin
>
> ---------
>
> "When brought to meaning, all importance becomes small, as in death,
> all life seems nothing. Knowing is destroyed by thinking,
> distilled into knowledge"
>
> William Wharton, "Birdy"
>
> --
> Author: Marin Dimitrov
> INET: marin_at_sirma.bg
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
Received on Tue Jun 06 2000 - 10:55:01 CDT