Oracle 12.1主键长度

huangapple go评论66阅读模式
英文:

Oracle 12.1 primary key length

问题

我们正在使用Liquibase并尝试在Oracle 12c发布版(12.1.0.1.0)中创建表格。

尝试创建表格时出现异常:

原因:liquibase.exception.DatabaseException: ORA-00972: 标识符过长

我搜索了一下,发现在版本12.2之前,Oracle中主键列的长度限制为30个字符,而UUID(我们用作主键)是36个字符,包括连字符。

之后,我尝试直接在数据库上执行创建语句,它成功了。我还尝试插入了一些条目,一切都看起来很正常。

如果我们能够手动创建表格和插入记录,那么导致Liquibase抱怨的问题可能是什么?

英文:

We are using Liquibase and are trying to create a table in Oracle 12c release (12.1.0.1.0).

When trying to create a table I get exception:

Reason: liquibase.exception.DatabaseException: ORA-00972: identifier is too long

I googled and found out that prior to version 12.2 the length of the primary key column in Oracle is restricted to 30 characters and UUID (which we use as a primary key) is 36 including hyphens.

After this I tried to execute create statement directly on the DB itself and it worked. I also tried inserting a few entries and all looks nice.

What could be the issue causing Liquibase to complain if we're able to manually create table and insert entries?

答案1

得分: 2

错误信息是:

ORA-00972: 标识符太长

出错的是标识符(即表格、列、约束或索引的名称),而不是存储在列中的值的长度。

您需要查看变更集以及Liquibase为表格生成的DDL语句,看看表格、列、约束或支持主键约束的索引的名称是否太长,并进行修正。

英文:

The error is:

ORA-00972: identifier is too long

It is the identifier (i.e. the name of the table, column, constraint or index) that is too long and not the length of the value being stored in the column.

You need to look at the changeset and the DDL statements that Liquibase is generating for the table and see whether the name of the table, column, constraint or the index backing the primary key constraint are too long and correct that.

huangapple
  • 本文由 发表于 2023年6月29日 22:08:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76581829.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定