ora-00972 标识符太长 oracle 10g
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2788031/
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 oracle 10g
提问by Frank
I am getting the error mentioned in the title.
我收到标题中提到的错误。
I am using a 36 charecter ID. This error is only thrown In my sqldatasource in my asp.net webform.
It is not a problem when I perform updates in Oracle sql developer
.
我使用的是 36 个字符的 ID。此错误仅在我的 asp.net 网络表单中的 sqldatasource 中引发。当我在Oracle sql developer
.
How can I fix this?
我怎样才能解决这个问题?
回答by Srinivas Reddy Thatiparthy
回答by dpbradley
If you are successfully executing DML (UPDATE tableName SET ...) from another environment such as SQL Developer, then your asp.net code must somehow be specifying or constructing the name of the table or a column name of the table incorrectly. Oracle will throw this exception if it parses either of these as >30 characters before any other checks.
如果您从 SQL Developer 等其他环境成功执行 DML (UPDATE tableName SET ...),那么您的 asp.net 代码必须以某种方式错误地指定或构造表名或表列名。如果在任何其他检查之前将其中任何一个解析为 >30 个字符,Oracle 将抛出此异常。
As Srinivas pointed out, the maximum length is 30, so a 36 character identifier can't be working from SQL Developer - can you post the statement that is "working" in SQL Developer?
正如 Srinivas 指出的,最大长度是 30,所以 36 个字符的标识符不能在 SQL Developer 中工作——你能在 SQL Developer 中发布“工作”的语句吗?
回答by APC
SERVICE_ID NVARCHAR2(36) NOT NULL
SERVICE_ID NVARCHAR2(36) 非空
Is your SQL Developer configured to use a multi-byte character set? Wild guess, especially as I would expect that to throw ORA-12899: value too large for column
rather than ORA-00972.
您的 SQL Developer 是否配置为使用多字节字符集?疯狂的猜测,尤其是因为我希望它抛出ORA-12899: value too large for column
而不是 ORA-00972。
回答by Bob Jarvis - Reinstate Monica
Ah, I see - it's not that column name that is 36 characters long, it's the actual data. Glad we cleared that one up.
啊,我明白了 - 这不是 36 个字符长的列名,而是实际数据。很高兴我们清除了那个。
As to "why is this happening from an ASP.NET SqlDataSource", I suspect that somewhere along the line there a problem converting between ASCII and Unicode. NVARCHAR2 is Unicode, but I suspect that something isn't playing nicely in the Unicode world. Check out you web server, your clients, your database, anything and everything you can think of - I suspect you'll find that somewhere along the line there's an ASCII client in there that doesn't talk Unicode properly, and is getting mixed up about the length of a Unicode string (32 Unicode characters take up 64 bytes (assuming UTF-16)).
至于“为什么从 ASP.NET SqlDataSource 发生这种情况”,我怀疑在某处存在在 ASCII 和 Unicode 之间转换的问题。NVARCHAR2 是 Unicode,但我怀疑某些东西在 Unicode 世界中表现不佳。检查您的 Web 服务器、您的客户端、您的数据库,以及您能想到的任何东西 - 我怀疑您会发现在此过程中的某个地方有一个 ASCII 客户端,它不能正确地使用 Unicode,并且正在混淆关于 Unicode 字符串的长度(32 个 Unicode 字符占用 64 个字节(假设为 UTF-16))。
Good luck.
祝你好运。