oracle SQL*Plus - 如何隐藏 SET ECHO OFF?

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

SQL*Plus - How do you hide SET ECHO OFF?

oraclesetechosqlplus

提问by CristiC

In SQL PLus, if I want to hide the command on screen, I use at the beginning of the script:

在 SQL PLus 中,如果我想在屏幕上隐藏命令,我在脚本的开头使用:

SET ECHO OFF

But what about this command? How to hide also this?

但是这个命令呢?如何隐藏这个?

In MS-Dos you could use @ in front of it, but in SQL*Plus?

在 MS-Dos 中,您可以在它前面使用 @,但在 SQL*Plus 中呢?

EDIT: I know the -S option for SQL*Plus, but the problem is that I am sending my script to the client and therefore I don't control how they are running SQL*Plus.

编辑:我知道 SQL*Plus 的 -S 选项,但问题是我将脚本发送到客户端,因此我无法控制它们如何运行 SQL*Plus。

采纳答案by René Nyffenegger

You might want to start SQL*Plus with the -Sflag:

您可能希望使用以下-S标志启动 SQL*Plus :

sqlplus -S user/password@db @path/to/your/script


The documentationsays: SILENT Option

文件说:静音选项

-S[ILENT]

-沉默的]

Suppresses all SQL*Plus information and prompt messages, including the command prompt, the echoing of commands, and the banner normally displayed when you start SQL*Plus. If you omit username or password, SQL*Plus prompts for them, but the prompts are not visible! Use SILENT to invoke SQL*Plus within another program so that the use of SQL*Plus is invisible to the user.

禁止所有 SQL*Plus 信息和提示消息,包括命令提示符、命令回显和启动 SQL*Plus 时通常显示的横幅。如果省略用户名或密码,SQL*Plus 会提示输入,但提示不可见!使用 SILENT 在另一个程序中调用 SQL*Plus,以便用户看不到 SQL*Plus 的使用。

SILENT is a useful mode for creating reports for the web using the SQLPLUS -MARKUP command inside a CGI script or operating system script. The SQL*Plus banner and prompts are suppressed and do not appear in reports created using the SILENT option.SILENT Option

SILENT 是一种在 CGI 脚本或操作系统脚本中使用 SQLPLUS -MARKUP 命令创建 Web 报告的有用模式。SQL*Plus 横幅和提示被抑制,不会出现在使用 SILENT 选项创建的报告中。SILENT 选项



So, with the silent option it seems that there won't be need to use set echoat all.

因此,使用静默选项似乎根本不需要使用set echo

回答by Mark J. Bobak

No, I know of no way to hide the 'set echo off' command itself, if echo is on.

不,我知道没有办法隐藏“设置回声关闭”命令本身,如果回声打开。

However, echo is off by default. So, if echo is on when you initially start SQL*Plus, perhaps you have a login.sql or glogin.sql that contains 'set echo on'?

但是,默认情况下回声是关闭的。因此,如果在您最初启动 SQL*Plus 时打开了 echo,那么您是否有包含“set echo on”的 login.sql 或 glogin.sql?

Check for glogin.sql in $ORACLE_HOME/sqlplus/admin, and for login.sql in the directory where you started SQL*Plus and any directory listed in $SQLPATH.

检查 $ORACLE_HOME/sqlplus/admin 中的 glogin.sql,以及启动 SQL*Plus 的目录和 $SQLPATH 中列出的任何目录中的 login.sql。

Hope that helps.

希望有帮助。