Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Auto increment sequence problem

639708May 16 2008 — edited May 16 2008
Hi,

Is there any particular thing about 21st record because, when i insert data into same or different table, records start from 21 instead of 1 or where it was finished before.

Example : I leave a table with 3 records. Come back, I insert data into same table then, auto increment starts from 21 not the 4!!!

Thanks

CREATE SEQUENCE FRANC_AUTOINC_SEQ
START WITH 1
INCREMENT BY 1
NOMAXVALUE;

CREATE TRIGGER FRANC_AUTOINC_TRG
BEFORE INSERT ON FRANCHISE
FOR EACH ROW
BEGIN
SELECT FRANC_AUTOINC_SEQ.NEXTVAL INTO :NEW.FRANCHISEID FROM DUAL;
END;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2008
Added on May 16 2008
9 comments
1,229 views