SQL ORA-00972 标识符太长别名列名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3085562/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ORA-00972 identifier is too long alias column name
提问by mcha
i have a query like :
我有一个查询,如:
SELECT column as averyveryveryverylongalias (more than 30 characters)
FROM Table_name
it returns the error ORA-00972 identifier is too long, is there any tip to make it work without making the alias shorter?
它返回错误ORA-00972 identifier is too long,是否有任何提示可以在不缩短别名的情况下使其工作?
Thanks
谢谢
回答by Tony Andrews
No, prior to Oracle version 12.2, identifiers are not allowed to exceed 30 characters in length. See the Oracle SQL Language Reference.
不可以,在 Oracle 12.2 版之前,标识符的长度不得超过 30 个字符。请参阅Oracle SQL 语言参考。
However, from version 12.2 they can be up to 128 bytes long.(Note: bytes, not characters).
但是,从 12.2 版开始,它们最长可达 128 个字节。(注意:字节,而不是字符)。
回答by mike cummings
The error is also caused by quirky handling of quotes and single qutoes. To include single quotes inside the query, use doubledsingle quotes.
该错误也是由对引号和单引号的古怪处理引起的。要包含在查询的单引号,用加倍的单引号。
This won't work
这行不通
select dbms_xmlgen.getxml("Select ....") XML from dual;
or this either
或者这个
select dbms_xmlgen.getxml('Select .. where something='red'..') XML from dual;
but this DOES work
但这确实有效
select dbms_xmlgen.getxml('Select .. where something=''red''..') XML from dual;
回答by Saptarshi
The object where Oracle stores the name of the identifiers (e.g. the table names of the user are stored in the table named as USER_TABLES and the column names of the user are stored in the table named as USER_TAB_COLUMNS), have the NAME columns (e.g. TABLE_NAME in USER_TABLES) of size Varchar2(30)...and it's uniform through all system tables of objects or identifiers --
Oracle 存储标识符名称的对象(例如用户的表名存储在名为 USER_TABLES 的表中,用户的列名存储在名为 USER_TAB_COLUMNS 的表中),具有 NAME 列(例如 TABLE_NAME在大小为 Varchar2(30) 的 USER_TABLES) 中......并且它在对象或标识符的所有系统表中都是统一的——
DBA_ALL_TABLES ALL_ALL_TABLES USER_ALL_TABLES
DBA_PARTIAL_DROP_TABS ALL_PARTIAL_DROP_TABS USER_PARTIAL_DROP_TABS
DBA_PART_TABLES ALL_PART_TABLES USER_PART_TABLES
DBA_TABLES ALL_TABLES USER_TABLES
DBA_TABLESPACES USER_TABLESPACES TAB
DBA_TAB_COLUMNS ALL_TAB_COLUMNS USER_TAB_COLUMNS
DBA_TAB_COLS ALL_TAB_COLS USER_TAB_COLS
DBA_TAB_COMMENTS ALL_TAB_COMMENTS USER_TAB_COMMENTS
DBA_TAB_HISTOGRAMS ALL_TAB_HISTOGRAMS USER_TAB_HISTOGRAMS
DBA_TAB_MODIFICATIONS ALL_TAB_MODIFICATIONS USER_TAB_MODIFICATIONS
DBA_TAB_PARTITIONS ALL_TAB_PARTITIONS USER_TAB_PARTITIONS
回答by John
I'm using Argos reporting system as a front end and Oracle in back. I just encountered this error and it was caused by a string with a double quote at the start and a single quote at the end. Replacing the double quote with a single solved the issue.
我使用 Argos 报告系统作为前端,使用 Oracle 作为后端。我刚刚遇到了这个错误,它是由一个字符串开头带双引号,结尾带单引号引起的。用单引号替换双引号解决了这个问题。
回答by NiTiN
If you have recently upgraded springboot to 1.4.3, you might need to make changes to yml file:
如果您最近将 springboot 升级到 1.4.3,您可能需要对 yml 文件进行更改:
yml in 1.3 :
1.3 中的 yml :
jpa:
hibernate:
namingStrategy: org.hibernate.cfg.EJB3NamingStrategy
yml in 1.4.3 :
1.4.3 中的 yml :
jpa:
hibernate:
naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
回答by GreatApps4YOU
As others have referred, names in Oracle SQL must be less or equal to 30 characters. I would add that this rule applies not only to table names but to field names as well. So there you have it.
正如其他人所提到的,Oracle SQL 中的名称必须少于或等于 30 个字符。我想补充一点,这条规则不仅适用于表名,也适用于字段名。所以你有它。