您为什么讨厌Oracle上的序列? [英] Why do you hate sequences on Oracle?

查看:73
本文介绍了您为什么讨厌Oracle上的序列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有些人不喜欢Oracle上的序列.为什么?我认为它们非常易于使用且非常好.您可以在选择,插入,更新...中使用它们.

Some people don't like sequences on Oracle. Why? I think they are very easy to use and so nice. You can use them in select, inserts, update,...

推荐答案

我不知道.我应该指出,有时候人们讨厌他们不了解的东西.

I don't. I should point out that sometimes people hate what they don't understand.

序列对于生成唯一ID非常重要.从概念上讲,拥有一种不依赖于表内容的生成ID的方法很有用.您无需锁定表即可生成唯一编号.

Sequences are incredibly important for generating unique IDs. Conceptually, it's useful to have a method of generating an ID that does not depend on the contents of a table. You don't need to lock a table in order to generate a unique number.

序列对于在需要唯一的多个表之间生成键也很有用.例如,如果我有一个新项目进入系统,并且想一次在多个表中放入一行,那么我可以从序列中获取一个ID,然后在插入任意数量的表中时重复使用它.正确完成后,我知道ID将不会与表中已有的值冲突,并且每一行将具有相同的ID.

Sequences can also be useful for generating keys across multiple tables that need to be unique. For instance, if I have a new item entering a system and I want to put a row in several tables at once, I can grab an ID from a sequence are reuse it when I insert into any number of tables. Done properly, I know the ID will not conflict with a value already in the tables and that each row will have the same ID.

我认为自动增量列也可以实现这些功能.

I would assume these things are also possible with auto-increment columns as well.

这篇关于您为什么讨厌Oracle上的序列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆