请问:oracle数据库中的多个表共用一个序列好吗??

解决方案 »

  1.   

    引用手册中的一段话:
    If two users concurrently increment the same sequence, then the sequence numbers each user acquires may have gaps, because sequence numbers are being generated by the other user. One user can never acquire the sequence number generated by another user. Once a sequence value is generated by one user, that user can continue to access that value regardless of whether the sequence is incremented by another user.Sequence numbers are generated independently of tables, so the same sequence can be used for one or for multiple tables. It is possible that individual sequence numbers will appear to be skipped, because they were generated and used in a transaction that ultimately rolled back. Additionally, a single user may not realize that other users are drawing from the same sequence.大抵的意思就是说可以多表共用一个序列,但单个表中的序列值会有gap,也就不是连续的值了。不过就像7楼说的
    ,最好还是每个表一个序列吧。。
      

  2.   

    可以啊。oracle中序列只是一个计数器而言,它告诉你,现在你数到多少了,下一个该是多少,具体把这个数用到那里,怎么用,由你决定