0

Hi,
When i insert data into any table last number of sequnce get increased in all sequences that are listed below. These are for auto incremented numbers. All tables have their own autoincremented coloumns. Can anyone see mistake? 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;

CREATE SEQUENCE EMP_AUTOINC_SEQ
  START WITH 1
  INCREMENT BY 1
  NOMAXVALUE;

CREATE TRIGGER EMP_AUTOINC_TRG
  BEFORE INSERT ON EMPLOYEE
  FOR EACH ROW
    BEGIN
      SELECT EMP_AUTOINC_SEQ.NEXTVAL INTO :NEW.EMPLOYEEID FROM DUAL;
    END;

CREATE SEQUENCE MNG_AUTOINC_SEQ
  START WITH 1
  INCREMENT BY 1
  NOMAXVALUE;

CREATE TRIGGER MNG_AUTOINC_TRG
  BEFORE INSERT ON MANAGER
  FOR EACH ROW
    BEGIN
      SELECT MNG_AUTOINC_SEQ.NEXTVAL INTO :NEW.MANAGERID FROM DUAL;
    END;

CREATE SEQUENCE CUST_AUTOINC_SEQ
  START WITH 1
  INCREMENT BY 1
  NOMAXVALUE;

CREATE TRIGGER CUST_AUTOINC_TRG
  BEFORE INSERT ON CUSTOMER
  FOR EACH ROW
    BEGIN
      SELECT CUST_AUTOINC_SEQ.NEXTVAL INTO :NEW.CUSTOMERID FROM DUAL;
    END;
2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by debasisdas
0

i have just deleted all sequences and inserted one data into a table. Then sequence's last number become 21 instead of 1.
???

0

Have run the nextval from any other query or only for testing the values ? it never happens that it will get incremented automaticalyy or affect other sequence objects.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.