User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Oracle section within the Web Development category of DaniWeb, a massive community of 402,690 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,414 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Oracle advertiser: Programming Forums
Views: 520 | Replies: 2
Reply
Join Date: Apr 2008
Posts: 179
Reputation: veledrom is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
veledrom veledrom is offline Offline
Junior Poster

Suqeunce problem

  #1  
Apr 28th, 2008
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;
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2008
Posts: 179
Reputation: veledrom is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
veledrom veledrom is offline Offline
Junior Poster

Re: Suqeunce problem

  #2  
Apr 28th, 2008
i have just deleted all sequences and inserted one data into a table. Then sequence's last number become 21 instead of 1.
???
Reply With Quote  
Join Date: Feb 2007
Location: Bangalore,India
Posts: 1,213
Reputation: debasisdas is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 78
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Nearly a Posting Virtuoso

Re: Suqeunce problem

  #3  
Apr 30th, 2008
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.
Share your Knowledge.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Oracle Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Oracle Forum

All times are GMT -4. The time now is 5:21 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC