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: NEWBIE needs help on autonumber

Re: NEWBIE needs help on autonumber

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sat, 06 Mar 1999 02:35:46 GMT
Message-ID: <36e1944b.1769734@192.86.155.100>


A copy of this was sent to pee_bee_at_my-dejanews.com (if that email address didn't require changing) On Sat, 06 Mar 1999 01:53:24 GMT, you wrote:

>Hi,
>Finally my boss have given me ORacle, so I can get rid of my MickeySoft shit.
>There is only one problem, how do I implement a autonumber field ??
>

create sequence my_seq;

create trigger my_trigger
before insert on my_table
for each row
begin

   select my_seq.nextval into :new.primary_key from dual; end;
/

where primary_key is the name of the column needing the autonumber.

>I can't find anything in the manuals ( as if you can find anything in it :)
>
>Please help
>
>Pb
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Fri Mar 05 1999 - 20:35:46 CST

Original text of this message

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