windows SQL Plus:如何更改目录并显示当前工作目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1840816/
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
SQL Plus: how to change directory and show current working directory
提问by Hugo Estrada
I just installed Oracle, and I am working with SQL*Plus because the GUI tool, SQL Developer, won't work.
我刚刚安装了 Oracle,并且我正在使用 SQL*Plus,因为 GUI 工具 SQL Developer 将无法工作。
I need to run some scripts, and I found that after starting SQLPlus I couldn't navigate from a session to another directory. The instructions that I did find after I searched on the internet all talk about a gui interface to SQLPlus which is no longer available on version 11. All what I get is a console window.
我需要运行一些脚本,我发现在启动 SQL Plus 后我无法从会话导航到另一个目录。我在互联网上搜索后找到的说明都谈到了 SQLPlus的 gui 界面,该界面在版本 11 中不再可用。我得到的只是一个控制台窗口。
Right now I hacked my way into making it work for me by creating a shortcut and then changing the starting directory to the directory where the scripts are housed.
现在,我通过创建一个快捷方式,然后将起始目录更改为脚本所在的目录,使其对我有用。
I can keep doing this, but I would like to know if there is a command that will let me know a) the current working directory and b) how to change directories
我可以继续这样做,但我想知道是否有一个命令可以让我知道 a) 当前工作目录和 b) 如何更改目录
Thanks in advance,
提前致谢,
Hugo
雨果
回答by shoover
Try: host pwd
and host cd somedir
. You can also enter just host
to get a command prompt.
尝试:host pwd
和host cd somedir
。您也可以仅输入host
以获取命令提示符。
Also, help
is your friend.
还有,help
是你的朋友。
回答by Karsten Spang
The host command runs a subshell under unix. Thus, cd
will change the directory in the subshell, but not for SQL*Plus itself.
host 命令在 unix 下运行一个子 shell。因此,cd
将更改子shell 中的目录,但不会更改SQL*Plus 本身。
回答by Guru
Even I had the same issue. I tried to find the solution, but I settled down for a run.sql file solution. You can try some thing like this.
即使我有同样的问题。我试图找到解决方案,但我找到了 run.sql 文件解决方案。你可以试试这样的事情。
C:\Guru>Dir
11/27/2009 10:29 AM <DIR> .
11/27/2009 10:29 AM <DIR> ..
09/02/2009 07:15 PM <DIR> fol
09/02/2009 08.15 PM run.sql
In run.sql specify
在 run.sql 中指定
@"c:\Guru\fol\a.sql"
show error
@"c:\Guru\fol\b.sql"
show error
And so on. You can give the folder structure as you wish. Even you can put them into windows BATCH file and execute them in one click.
等等。您可以根据需要提供文件夹结构。甚至您可以将它们放入 Windows BATCH 文件中并一键执行。