是否更好在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.
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.
更多推荐
发布评论