如何覆盖 Oracle DB 中的 >2499 个字符错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48316340/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:29:54  来源:igfitidea点击:

How to override >2499 character error in Oracle DB?

oracleoracle11goracle10gsqlplus

提问by user9185088

I have a Oracle query which I'm executing through shell script and in that my query is getting exceeded the maximum length of 2499.

我有一个通过 shell 脚本执行的 Oracle 查询,因为我的查询超出了 2499 的最大长度。

I'm getting error

我收到错误

SP2-0027: INPUT IS TOO LONG(> 2499 CHARACTERS) - LINE IGNORED

SP2-0027:输入太长(> 2499 个字符)- 行被忽略

回答by Jon Heller

Here are some options for working around SQL*Plus line length limitations:

以下是解决 SQL*Plus 行长度限制的一些选项:

  1. Upgrade to 12.2(?) client.On 12.2 the client allows up to 4999 characters. Which is infuriating in a way - if Oracle finally admits that 2499 is not enough, why did they only increase the limit to 4999?
  2. Add line breaks.Split the results into multiple lines. If using Windows make sure to use both carriage return and newline - chr(13)||chr(10).
  3. Use another program.Many programs have a SQL*Plus-like option. In general I recommend notusing a SQL*Plus clone. The main advantage of SQL*Plus is that it's a simple tool and works just about the same everywhere. None of the SQL*Plus clones are fully compatible and many programs will break if you run SQL*Plus scripts on a clone.
  1. 升级到 12.2(?) 客户端。在 12.2 上,客户端最多允许 4999 个字符。这在某种程度上是令人气愤的——如果甲骨文最终承认 2499 不够,为什么他们只将限制增加到 4999?
  2. 添加换行符。将结果拆分为多行。如果使用 Windows,请确保同时使用回车符和换行符 - chr(13)||chr(10)
  3. 使用另一个程序。许多程序都有类似 SQL*Plus 的选项。一般来说,我建议不要使用 SQL*Plus 克隆。SQL*Plus 的主要优点是它是一个简单的工具,而且在任何地方的工作方式都差不多。没有一个 SQL*Plus 克隆是完全兼容的,如果您在一个克隆上运行 SQL*Plus 脚本,许多程序将会中断。

回答by Decula

The real issue is input SQL text itself is too long, single line exceed 2500 characters, not about the data inside the database. To workaround the error, you should follow the steps from @Jon Heller

真正的问题是输入SQL文本本身太长,单行超过2500个字符,而不是数据库里面的数据。要解决该错误,您应该按照@Jon Heller 的步骤操作

回答by Littlefoot

Try to add a line break somewhere in that long line; that's a limitation of SQL*Plus and, as far as I can tell, you can't avoid it by some setting (like SET LINESIZE 100 and similar).

尝试在那条长行的某处添加一个换行符;这是 SQL*Plus 的一个限制,据我所知,您无法通过某些设置(例如 SET LINESIZE 100 和类似设置)来避免它。