Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Automatic record counter
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
![]() |
![]() |