简体   繁体   English

Oracle SQL 开发人员 - 假脱机错误

[英]Oracle SQL Developer - Spooling error

I am learning SQL at the moment, and am using Oracle SQL Developer.我现在正在学习 SQL,并且正在使用 Oracle SQL Developer。

Right now I am having an issue with the spool command.现在我遇到了 spool 命令的问题。

I insert the file path and name the file but I keep getting an "unknown command" error.我插入文件路径并命名文件,但我不断收到“未知命令”错误。

spool C:\Users\user\Desktop\AAA_Task1\output.txt
set echo on
--drop table TESTTABLE;
create table TESTTABLE (TestCol int);
set echo off
spool off

I alternate between the create and drop statements for each test.我在每个测试的创建和删除语句之间交替。

I run the and the table is created or dropped correctly, but I get a line one error "Unknown Command" and no text file is created.我运行并正确创建或删除了表,但我收到第一行错误“未知命令”并且没有创建文本文件。

I have attached a picture of a test command and the error.我附上了测试命令和错误的图片。

If someone could point me in the right direction I would be grateful.如果有人能指出我正确的方向,我将不胜感激。

Oracle SQL Developer - 假脱机问题

There is difference between run script and run statement, see here . 运行脚本和运行语句之间有区别,请参见此处 Use following commands and run script. 使用以下命令并运行脚本。

spool 'C:\Users\user\Desktop\AAA_Task1\output.txt'
set echo on
--drop table TESTTABLE;
create table TESTTABLE (TestCol int);
set echo off
spool off

Making the file path in quotes did not work for me in the Oracle database.在 Oracle 数据库中,用引号引起来的文件路径对我不起作用。

spool data.txt
set echo on
Query -- the query
set echo off
spool off

this will save the query and output to the data.txt file in the "C:\Users\NELSON JOSEPH\AppData\Roaming\SQL Developer\data.txt" in this location likewise username varies for others.这会将查询和 output 保存到此位置"C:\Users\NELSON JOSEPH\AppData\Roaming\SQL Developer\data.txt"中的 data.txt 文件,同样用户名因其他人而异。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM