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

Home -> Community -> Usenet -> c.d.o.server -> Re: Autoincrement

Re: Autoincrement

From: <buurd_at_my-deja.com>
Date: Thu, 14 Oct 1999 14:09:15 GMT
Message-ID: <7u4o5v$kqa$1@nnrp1.deja.com>


Many thanks!

In article <lsoFOP9RXA4Az2ysK0rtcQSkyvNI_at_4ax.com>,   tkyte_at_us.oracle.com wrote:
> A copy of this was sent to buurd_at_my-deja.com
> (if that email address didn't require changing)
> On Thu, 14 Oct 1999 09:45:16 GMT, you wrote:
>
> >Hi!
> >I'm looking for a function in Oracle that would autoincrement an
> >idcolumn so that every column gets it's own uniqe number. I'll looked
> >at seqences but i don't understand how to automate the process so
that
> >for every new row there is a new (uniqe) number.
> >
> >Tia
>
> create sequence myseq;
>
> create or replace trigger my_trigger
> BEFORE INSERT on MY_TABLE
> for each row
> begin
> select myseq.nextval into :new.IDColumn from dual;
> end;
> /
>
> is the way to do it in Oracle.
>
> --
> See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to
Oracle8i'...
> Current article is "Part I of V, Autonomous Transactions" updated
June 21'st
>
> Thomas Kyte tkyte_at_us.oracle.com
> Oracle Service Industries Reston, VA USA
>
> Opinions are mine and do not necessarily reflect those of Oracle
Corporation
>

--
Roland Carlsson
Certified Java programmer
Skövde
Sweden

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Oct 14 1999 - 09:09:15 CDT

Original text of this message

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