sql - Oracle SQLPlus : Echo without line numbers?

标签 sql oracle logging plsql sqlplus

我正在开发一个解决方案,其中多个 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*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.

关于sql - Oracle SQLPlus : Echo without line numbers?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59210786/

相关文章:

c# - 我哪里错了?动态创建标签 c#

python - 如何禁用特定模块的日志记录

logging - Windows 服务日志文件位置的 'best practice' 是什么?

c - Linux 内核中的进入和退出打印

java - 如何获取hibernate实体的方言特定sql?

mysql - 构建一个按月分割支出的查询。 (将一行变成多行)

javascript - 是否存在创建 SQL 查询生成器界面的 jQuery 或 JavaScript 模块?

oracle - 我可以在没有 Oracle JDBC 驱动程序的情况下连接到 Oracle 数据库吗?

sql - 在不可连接的列上右连接

java - sqlException : column not found JPA @query