DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Using Sequences

  1. #1
    Join Date
    Jan 2000
    Location
    Manama, Bahrain
    Posts
    50
    I would like to create a sequence to automatically generate primary key values for a table.

    Can I confine a sequence to be used only for one table and not any other? Also can I prevent it from skipping values when storing in one table.
    e.g. I would like all values from 1 till 5 to be stored in a table as a primary key; and don't want it to be like 1,3,4,5.

  2. #2
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    You choose the way that the sequence is used. So, if you only want one column to be driven from your sequence, that is your option.

    You can populate your primary key with the sequence using nextval, currval etc. If you increment the sequence and then rollback or you delete rows, then there will be gaps.
    David Knight
    OCP DBA 8i, 9i, 10g

  3. #3
    Join Date
    Feb 2000
    Location
    Singapore
    Posts
    1,758
    also the aging out of cached sequence values from SGA may cause gaps.

    Sanjay

  4. #4
    Join Date
    Feb 2002
    Posts
    27
    if perforamnce is not a big issue , nocache option can solve the aging problem.


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