If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > How do I redirect output file using SPOOL

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-04-10, 11:30
davisb davisb is offline
Registered User
 
Join Date: Feb 2010
Posts: 12
How do I redirect output file using SPOOL

The output file is being created in the same place where the sql file is sitting
which is /sql/x.prt
In this case, I used SPOOL x.prt

i need the file to be created in /reports/x.prt

In this case,

I tried ....... SPOOL /../../../x.prt
also...
i tried ....... SPOOL '/../../../x.prt'
i tried ....... SPOOL "'/../../../x.prt'"
i tried ....... SPOOL "/../../../x.prt"

I even tried \..\..\..\x.prt
Reply With Quote
  #2 (permalink)  
Old 02-04-10, 13:49
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,085
this is not an ANSI SQL question

which database system are you using? the thread will have to be moved to the appropriate forum
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 02-05-10, 11:40
davisb davisb is offline
Registered User
 
Join Date: Feb 2010
Posts: 12
SQLPLUS question? on how to use SPOOL?

I've been to the Oracle forum... they've responded similar to you.
Reply With Quote
  #4 (permalink)  
Old 02-05-10, 12:02
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Never heard of it I'm afraid (as such, you will probably struggle to get much response from anyone).

Is it a server or desktop database?
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #5 (permalink)  
Old 02-05-10, 12:05
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,085
Quote:
Originally Posted by davisb View Post
I've been to the Oracle forum... they've responded similar to you.
they told you it wasn't an ANSI SQL question???
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #6 (permalink)  
Old 02-05-10, 13:18
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,298
Quote:
Originally Posted by r937 View Post
they told you it wasn't an ANSI SQL question???
No, we told him/her it's neither a SQL nor an Oracle question, because it's essentially a Windows problem.

The path is totally messed up: it's not a valid Windows path (because of the forward slash), and it's logically wrong because the path denotes a directory one level up starting at the root directory...
Reply With Quote
  #7 (permalink)  
Old 02-08-10, 07:10
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,578
Forward-slashes are fine on Windows. But that still doesn't make it an SQL question, of course.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #8 (permalink)  
Old 02-08-10, 07:51
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,298
Quote:
Originally Posted by stolze View Post
Forward-slashes are fine on Windows.
In theory yes, but not for all applications (or built-in commands). Notepad can handle forward slashes, but e.g. Textpad or the DIR command cannot (as they use the forward slash for parameters).

SQL*Plus can deal with forward slashes in the SPOOL command, but not for "including" files (e.g. @/path/to/somescript.sql)
Reply With Quote
  #9 (permalink)  
Old 02-08-10, 14:20
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,578
That makes sense. I usually use forward slashes only in code I write, and I don't care about Windows or not in this context. Fortunately, parameters are irrelevant in that case.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On