Home » Other » Client Tools » Spool Error in SQL*Plus (11.1.0)
Spool Error in SQL*Plus [message #482436] Thu, 11 November 2010 09:54 Go to next message
sparkie
Messages: 2
Registered: November 2010
Location: az
Junior Member
Am getting error: not spooling currently when executing this code
set heading off pages 0 trimspool on feedback off echo off timing off

col spoolname new_value spoolname
select 'C:\Atlanta_'||to_char(sysdate, 'yymmdd') spoolname from dual
spool '&spoolname'

select '1', 'X' from dual;

spool off

[EDITED by LF: fixed topic title. The original was "Spool Error in PLSQL"]

[Updated on: Thu, 11 November 2010 10:30] by Moderator

Report message to a moderator

Re: Spool Error in PLSQL [message #482437 is a reply to message #482436] Thu, 11 November 2010 10:00 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
set termout off
col dt new_value dt
select to_char(sysdate,'YYYYMMDDHH24MISS') dt from dual;
set termout on
spool file_&dt
...
spool off

It would be helpful if you followed Posting Guidelines - http://www.orafaq.com/forum/t/88153/0/

[Updated on: Thu, 11 November 2010 10:01]

Report message to a moderator

Re: Spool Error in PLSQL [message #482438 is a reply to message #482436] Thu, 11 November 2010 10:01 Go to previous messageGo to next message
cookiemonster
Messages: 13961
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you copy and paste the actual execution from sqlplus:
SQL> set heading off pages 0 trimspool on feedback off echo off timing off
SQL> 
SQL> col spoolname new_value spoolname 
SQL> select 'C:\Atlanta_'||to_char(sysdate, 'yymmdd') spoolname from dual 
  2  spool '&spoolname'
  3  
SQL> select '1', 'X' from dual;
1 X
SQL> 
SQL> spool off 
not spooling currently

You'll see it treats the spool command as part of the select statement. Try putting a ; at the end of the select statement.

And what has PL/SQL got to do with any of this?
Re: Spool Error in PLSQL [message #482441 is a reply to message #482438] Thu, 11 November 2010 10:13 Go to previous messageGo to next message
sparkie
Messages: 2
Registered: November 2010
Location: az
Junior Member
I am sorry i incorrectly typed PLSQL...i am new return to SQL plus and merely typed the wrong thing. I do apologize.
Re: Spool Error in PLSQL [message #482445 is a reply to message #482441] Thu, 11 November 2010 10:34 Go to previous message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Before your next question, Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.

Regards
Michel
Previous Topic: Difference between slash and semicolon
Next Topic: add fucntion to existing package
Goto Forum:
  


Current Time: Sun Dec 22 05:59:54 CST 2024