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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Automatic record counter

Re: Automatic record counter

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Mon, 16 Oct 2000 18:37:18 +0800
Message-ID: <39EADA5E.73BD@yahoo.com>

rdf wrote:
>
> Hallo, i hope you help me.
>
> How can i setup an Oracle tables with an automatic counter field ?
> Should be like Access primary keys...
>
> Thanks.

Use a trigger and a sequence...

create sequence blah;

create trigger more_blah
before insert on my_table
for each row
begin
  select blah.nextval
  into :new.id_col
  from dual;
end;

HTH

-- 
===========================================
Connor McDonald
http://www.oracledba.co.uk
(faster/mirrored at http://www.oradba.freeserve.co.uk)

Its not the voices in my head that bother me... 
  its the voices in yours.
Received on Mon Oct 16 2000 - 05:37:18 CDT

Original text of this message

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