Autonumber

From: Smiths9312 <smiths9312_at_aol.com>
Date: 27 Sep 1998 17:45:47 GMT
Message-ID: <19980927134547.05884.00002446_at_ng-fd1.aol.com>


I am designing a database with an Access front-end and Oracle tables. Recently I have run into a problem with an autonumber field. I have researched my Oracle book and the following is the code I think will do the job. Could someone please look over it to make sure it is correct

To create a sequence number:

CREATE SEQUENCE SAMPLE_AUTONUMBER
INCREMENT BY 1
START WITH 1
NOMAXVALUE
NOCYCLE
CACHE 20; A trigger that inserts the sequence number into the Counter field.

CREATE TRIGGER COUNTER_INCREMENT
BEFORE INSERT ON SAMPLE_TABLE
FOR EACH ROW
BEGIN
INSERT INTO SAMPLE_TABLE (SAMPLE_COUNTER) VALUES (SAMPLE_AUTONUMBER_NEXTVAL);
END; [Quoted] For some reason the trigger code doesn't do anything when it is entered. SQL acts like there should be more code and doesn't run it. Received on Sun Sep 27 1998 - 19:45:47 CEST

Original text of this message