sqloracle-databasespool

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 - Spooling issue


Solution

  • 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