SQL 奇怪的 Oracle 错误:标识符太长 ORA-00972
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7964891/
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
Strange Oracle error: Identifier too long ORA-00972
提问by Muzaaya Joshua
I have faced this problem when working with ORACLE 10g. I read the answers given to this question here (ora-00972 identifier is too long oracle 10g) on stack overflow but they have not worked for me. Perhaps my situation is different.
我在使用 ORACLE 10g 时遇到过这个问题。我在这里阅读了这个问题的答案(ora-00972 标识符太长 oracle 10g) 堆栈溢出,但它们对我不起作用。可能我的情况不一样。
Now i had these table names:WIMAX_TRAFFIC_STATS
and WIMAX_RADIO_STATS
. When i tried inserting data into them through an ODBC Connection with Erlang/OTP
, i got the error:
现在我有了这些表名:WIMAX_TRAFFIC_STATS
和WIMAX_RADIO_STATS
. 当我尝试通过 ODBC 连接向其中插入数据时Erlang/OTP
,出现错误:
{error,"[DataDirect][ODBC Oracle Wire Protocol driver][Oracle]ORA-00972:所以,我搜索谷歌并找到答案说可能我的表名太长了。所以我在下面做了这个并再次尝试:
identifier is toolong SQLSTATE IS: HY000"}
SQL> ALTER TABLE WIMAX_RADIO_STATS RENAME TO WR; Table altered. SQL> ALTER TABLE WIMAX_TRAFFIC_STATS RENAME TO WT; Table altered.我仍然遇到同样的错误。其他来源说这可能是我在一些专栏中写的数据。我的表定义如下:
SQL> DESCRIBE WT; Name Null? Type ----------------------------------------- -------- ----------------- SDATE DATE ELEMENT_TYPE VARCHAR2(50) MANAGED_ELEMENT VARCHAR2(50) USER_LABEL VARCHAR2(200) JOB_ID VARCHAR2(50) MEAS_TYPE VARCHAR2(50) MEAS_VALUE VARCHAR2(50)
None of the data values i write there is longer than the column length definition. I really wonder. Am attempting to write strings that are less than 10 characters long in the table but yet still getting this error. Some body help, please !
我在那里写的数据值都没有比列长度定义长。我真的很奇怪。我正在尝试在表中写入长度少于 10 个字符的字符串,但仍然出现此错误。一些身体帮助,请!
EDIT
SAMPLE query request is as follows:
EDIT
SAMPLE 查询请求如下:
INSERT INTO WT(element_type,managed_element,user_label,job_id,meas_type,
meas_value) VALUES("BreezeMAX MBS",
"SubNetwork=ASN,MeContext=,ManagedElement=MBS.172.17.9.9",
"BMAX-Shoal2[MTN-Egate]",
"99297","rbMngmntPortPacketsDiscardedOnRx","0");
The SDATE field has a default set as sysdate
SDATE 字段的默认设置为 sysdate
回答by Mat
You're using the wrong quotes.
您使用了错误的引号。
VALUES('BreezeMAX MBS',
^ ^
Demo:
演示:
SQL> create table t (a varchar(100));
Table created.
SQL> insert into t(a) values ("qasdqsdqsdqsdqsdqsdqsdlmqmsldqsmldqsmldq");
insert into t(a) values ("qasdqsdqsdqsdqsdqsdqsdlmqmsldqsmldqsmldq")
*
ERROR at line 1:
ORA-00972: identifier is too long
SQL> insert into t(a) values ('qasdqsdqsdqsdqsdqsdqsdlmqmsldqsmldqsmldq');
1 row created.