using sequence cause inserted rows not in order
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: using sequence cause inserted rows not in order

  1. #1
    Join Date
    Jun 2004
    Posts
    1

    using sequence cause inserted rows not in order

    Halu.. i wanna ask about inserted records using sequence. I created a seq for table t1. I insert 10 rows or record and the id (which is the pk) shows the records in order (1.2.3.4.5.6.7.8.9.10). Then i delete one of the record (where id=3). I inserted one record into table t1 but when i select back the id appeared to be not in order which is id=1,2,11,4,5,6,7,8,9,10. Why is this happening? Why the next record is inserted in the space of id=3 whihch i had deleted? And how to resolve this?

  2. #2
    Join Date
    Oct 2002
    Posts
    807
    Read up on sequences (and inserts for that matter).

  3. #3
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434

    Re: using sequence cause inserted rows not in order

    Originally posted by merah
    Why is this happening?
    coz u have not used order by
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  4. #4
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    It's not a matter of sequences, what you are probably seeing is empty space being re-used inside the data block -- the "11" record has taken the empty slot left by the delete of the "3" record.
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  5. #5
    Join Date
    Jul 2002
    Location
    Northampton, England
    Posts
    612
    Thats right, the sequence is doing its job by incrementing the number by one.. The order in which you view the data has nothing to do with the sequence.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width