Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL*Plus and spool command

68 views
Skip to first unread message

Mikael Horseman

unread,
Feb 9, 2002, 5:12:41 PM2/9/02
to
With apologies in advance if this is a repeat question (I haven't been able
to track down the solution elsewhere).
Environment: Windows 2000 SP2, Oracle 8i.

If I log in to SQL*Plus and write:

SQL> SPOOL myfile.txt;

...then any subsequent operations are mirrored out to 'myfile.txt'.
If I invoke the Editor (I'm using Notepad) and write:

SPOOL myfile.txt;
SELECT *
FROM mytable;
SPOOL OFF;

...and then use '/' when returned to the command line I get a message:

"ERROR at line 1:
ORA-00900: invalid SQL statement"

I've browsed various newsgroup messages that mention Spooling issues (with
different people suggesting the removal or a different orientation of
semi-colons), and I've tried several variations on that basis - but I get
the same error message every time. I suspect that the problem might be a
product of some fundamental misunderstanding I'm having about SQL*Plus here,
but I can't work out what it might be. Any help appreciated

Kind regards

Mikael Horseman


Daniel A. Morgan

unread,
Feb 9, 2002, 7:27:12 PM2/9/02
to
Some things can be done in the editor ... somethings can only be done at the
SQL> command line.

Daniel Morgan

Sybrand Bakker

unread,
Feb 9, 2002, 6:56:49 PM2/9/02
to

"Mikael Horseman" <newg...@newgroup.com> wrote in message
news:a445vb$vft$1...@news7.svr.pol.co.uk...

Invoking the editor without a filename edits the *sql* buffer.
So any statement in that buffer when you return to the command prompt is
considered a *sql* statement. SPOOL is not a sql statement it is a *sqlplus*
statement.
You need to save your combination of sql*plus and sql commands to an O/S
file and run that O/S file by using
@<filename>
or
start <filename>

Of course this behavior is described in the sql*plus reference manual.

Regards

--
Sybrand Bakker
Senior Oracle DBA

to reply remove '-verwijderdit' from my e-mail address


Mikael Horseman

unread,
Feb 10, 2002, 6:49:35 AM2/10/02
to
With you - many thanks to you both for your help

Mikael


"Sybrand Bakker" <pos...@sybrandb.demon.nl> wrote in message
news:u6cg95h...@corp.supernews.com...

0 new messages