我正在开发一个解决方案,其中多个 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.
我们将此输出作为运行日志保存在我们的构建环境中,但也可以作为纯文本文件访问它。
然而,这种格式的一个缺点是,如果我想复制代码的某个部分并在 IDE(如 Toad 或 SQL Developer)中再次运行它,则很难排除行号。
是否可以告诉 SQL*Plus 输出上述代码,但不包括行号?
最佳答案
您可以使用选项 sqlnumber
and sqlprompt
:
set sqlprompt ''
set sqlnumber off
SET SQLN[UMBER] {ON|OFF}
SET
SQLNUMBER
is not supported in iSQL*PlusSets 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 ofSQLPROMPT
.
关于sql - Oracle SQLPlus : Echo without line numbers?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59210786/