Oracle中的序列与标识列(Sequences vs Identity columns in Oracle)

编程入门 行业动态 更新时间:2024-10-27 05:26:27
Oracle中的序列与标识列(Sequences vs Identity columns in Oracle)

是否更好在oracle中使用Sequences并使用Before insert触发器自动增加列或使用Oracle 12 c中可用的标识列?

Is it better to use Sequences in oracle and auto-increment a column using Before insert trigger or to use identity columns as it is available in Oracle 12 c?

最满意答案

无论哪种方式,你都将使用Sequences。 12c中的标识列在幕后使用相同的机制。

好处 - 数据库管理这些对象,而不是你。

在此处输入图像描述

引入该功能是为了帮助从SQL Server和Sybase ASE这些受欢迎的地方迁移系统。 迁移更简单,而不是创建序列/触发器对来维持前进。

而且这种好处也扩展到了常规的Oracle客户。 IDENTITY子句​​的灵活性包括手动定义序列时可以设置的所有内容。

Either way you're going to be using Sequences. Identity columns in 12c use the same mechanism behind the scenes.

The benefit - the db is managing these objects, and not you.

enter image description here

The feature was introduced to aid in the migration of systems from places like SQL Server and Sybase ASE where these were popular. Much simpler to migrate as is than create a sequence/trigger pair to maintain going forward.

And that benefit extends to regular Oracle customers as well. The flexibility of the IDENTITY clause includes everything you can set when manually defining a sequence.

更多推荐

本文发布于:2023-07-30 12:35:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1337878.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:序列   标识   Oracle   columns   Identity

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!