如何在SQL Developer Oracle中使用假脱机命令 [英] How to use spool command in sql developer oracle

查看:361
本文介绍了如何在SQL Developer Oracle中使用假脱机命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的, 我不能使用假脱机命令.它不起作用,或者我没有做正确的事. 我正在尝试将查询结果保存到txt文件中(也尝试过使用select /*csv*/ * from table保存csv,但是它也无法正常工作.)

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).

所以我写的是:

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

execute statement ORA-00900:invalid SQL statement时出现错误. SQL工作正常-当我仅执行该部分时,它将输出显示到屏幕上.我应该如何将输出保存到文件中?

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?

我已经尝试删除set echo offset trimspool on,但是这些都没有帮助

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

推荐答案

这是我在SQL开发人员上运行的内容:

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;

我在文件test1中得到了输出.您需要将所有命令作为脚本运行.

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

这篇关于如何在SQL Developer Oracle中使用假脱机命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆