我试图在文本文件中保存查询结果,但我的假脱机不保存查询结果,而是查询本身。看看Stack Overflow我看到了一个解决方法 - 保存一个SQL脚本文件并运行该脚本,但它也不起作用。
set verify off
set echo off
spool C:\PSR\output.sql
select id_issue
from
mo_test
where
rownum<10;
spool off
@C:\PSR\output.sql
Error starting at line : 1 File @ C:\PSR\output.sql
In command -
SQL> select id_issue
Error report -
Unknown Command
Error starting at line : 2 File @ C:\PSR\output.sql
In command -
from
Error report -
Unknown Command
Error starting at line : 3 File @ C:\PSR\output.sql
In command -
mo_test
Error report -
Unknown Command
...
“关于SQL Developer”的软件版本:
Oracle IDE 4.1.5.21.78 JDK 1.8.0_102
这是4.1.5及更早版本(例如see this)中的预期行为。
我相信版本4.2.0中的行为发生了变化,而在当前版本18.2中,它确实可以按照您的意愿运行;所以你真的需要升级以避免这个问题。 You can download it here。
你还需要添加
set heading off
到脚本的开头,这将删除标题行(如果存在则会导致自己的错误);或者在以后的版本中,您可以:
set pages 0
相反(或同样),这将删除标题行和更多空行。