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

2021-12-30 00:00:00 oracle11g oracle oracle10g sqlplus

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

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.

我收到错误

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

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

推荐答案

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

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

  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 脚本,许多程序将会中断.
  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 not using 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.

相关文章