How to use spool command in sql developer oracle

匆匆过客 提交于 2019-12-11 06:03:57

问题


Dears, I cannot use spool command. It is not working or i am not doing something right. I am trying to save query result in txt file (tried also csv saving with select /*csv*/ * from table but it also did not work).

So what i wrote is:

set echo off
set trimspool on
spool 'C:\Users\username\Desktop\clobams\Test1.txt'
select  pn, serial_number from stock ;
spool off;

And i am getting error when pressing execute statement ORA-00900:invalid SQL statement . Sql works fine - when i execute only that part,it gives me output to the screen. How should i save my output to the file?

I have already tried to remove set echo off and set trimspool on but none of these helped


回答1:


this is what i have run on my sql developer:

spool C:\Users\**direcotory**\Desktop\old desktop\sql\Test1.txt;
select  *  from YOUR_TABLE;
spool off;

and i got output in file test1. you need to run all commands as script.



来源:https://stackoverflow.com/questions/49528653/how-to-use-spool-command-in-sql-developer-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!