Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to Generate Auto Number
create sequence SEQ_MYTABLE_ID start with 1 increment by 1;
create trigger TR_MYTABLE_ID
before insert on MYTABLE
for each row
begin
select SEQ_MYTABLE_ID.nextval into :new.MYTABLE_PK_FIELD_NAME from dual;
end;
insert into MYTABLE values (Null, field2, field3, ...);
place a null in the PK field during the insert.
"Arun Solleti" <solleti_at_eng.usf.edu> wrote in message
news:39B02569.107AA306_at_eng.usf.edu...
> Hi
>
> Can anyone tell me, what is the data type which will generate a primary
> key for a given table. It is like AutoNumber in access which can be set
> as the primary key. How to set the starting point for this and
> incremental value.
>
> Thanks
> Arun
>
Received on Fri Sep 01 2000 - 18:04:48 CDT
![]() |
![]() |