简体   繁体   中英

Oracle SQL Developer - Spooling error

I am learning SQL at the moment, and am using Oracle SQL Developer.

Right now I am having an issue with the spool command.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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