Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: auto increment of primary key in ORACLE
1 create a sequence
CREATE SEQUENCE pk_seq INCREMENT BY 1;
2 code the insert statement to insert the nextval of the sequence
INSERT INTO emp (empno, ename, job, sal, comm, deptno)
VALUES (pk_seq.netval, 'JINKS', 'CLERK', 1.2E3, NULL, 40);
You do not need a trigger as other posts say if you are writing the insert code.
Mike
wolfgang karrer <wolfgang.karrer_at_ce.uni-linz.ac.at> wrote in message
news:37AE7559.7592CB7C_at_ce.uni-linz.ac.at...
> Hi,
>
> is it possible to auto increment the primary key of a table, like
>
> table emp
> empnr INTEGER primary key
>
> thanx for helping me!
>
Received on Mon Aug 09 1999 - 21:10:19 CDT
![]() |
![]() |