Re: How to define a selfincrement attribute ...
From: Steve mouatt <steve_at_bedrockcomputers.demon.co.uk>
Date: Wed, 06 May 1998 15:50:11 +0100
Message-ID: <355078A3.557F_at_bedrockcomputers.demon.co.uk>
Date: Wed, 06 May 1998 15:50:11 +0100
Message-ID: <355078A3.557F_at_bedrockcomputers.demon.co.uk>
Michael Maretzke wrote:
>
> Hello, out there !
>
> I've got a little newbie problem.
>
> I need a ID in my table which is autoincrementing.
> Should I solve this problem using a Trigger or is there
> another solution.
>
Assuming that you are using Oracle 7 or better the you should use a sequence.
Thus when you insert a new record into the table it would look along the
lines of
INSERT INTO MYTAB
(ID,FORENAME,SURNAME)
(SELECT MYSEQ.NEXTVAL,'Fred',Flintstone' FROM DUAL;
Steve Received on Wed May 06 1998 - 16:50:11 CEST