本文介绍了如何在Windows中将oracle sql结果输出到文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试过

select * from users
save D:\test.sql create;

但是SQL plus给我没有正确的结局"如何在Windows中的oracle sql中指定路径?

But SQL plus gives me "no proper ended"How to specify path in oracle sql in windows?

推荐答案

使用线轴:

spool myoutputfile.txt
select * from users;
spool off;

请注意,这将在您运行SQL * Plus的目录中创建myoutputfile.txt.

Note that this will create myoutputfile.txt in the directory from which you ran SQL*Plus.

如果您需要在SQLPlus启动时从SQL文件(例如"tmp.sql")运行此文件并将其输出到名为"output.txt"的文件中,请执行以下操作:

If you need to run this from a SQL file (e.g., "tmp.sql") when SQLPlus starts up and output to a file named "output.txt":

tmp.sql:

select * from users;

命令:

sqlplus -s username/password@sid @tmp.sql > output.txt

请介意,我现在没有Oracle实例,因此您可能需要做一些自己的工作才能调试我从内存中写的内容.

Mind you, I don't have an Oracle instance in front of me right now, so you might need to do some of your own work to debug what I've written from memory.

这篇关于如何在Windows中将oracle sql结果输出到文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 02:31
查看更多