Oracle SQLPlus:回显没有行号?

Oracle SQLPlus: Echo without line numbers?

我正在研究一个解决方案,其中多个 SQL 和 PL/SQL 脚本通过 SQL*Plus 以一批方式 运行 在一起。

我在脚本的相关点声明了SET ECHO OFF;SET ECHO ON;,以便输出相关代码。

目前输出看起来像这样:

SQL> DECLARE
  2      ct number := 0;
  3      ctChanges number := 0;
  4  
  5  BEGIN
  6      select count(*) into ct from ...
  7  (...rest of code block...)
"some specific status message"
Commit executed.

我们将此输出作为 运行-log 在我们的构建环境中保存,但也可以将其作为纯文本文件访问。

然而,这种格式的一个缺点是,如果我想复制代码的某个部分,然后 运行 在 IDE 中再次复制它(例如 Toad 或 SQL 开发人员),很难排除行号。

是否可以告诉 SQL*Plus 输出上面的代码,但不包括行号?

您可以使用选项 sqlnumber and sqlprompt:

set sqlprompt ''
set sqlnumber off

SET SQLN[UMBER] {ON|OFF}

SET SQLNUMBER is not supported in iSQL*Plus

Sets the prompt for the second and subsequent lines of a SQL command or PL/SQL block. ON sets the prompt to be the line number. OFF sets the prompt to the value of SQLPROMPT.