Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2010
    Posts
    12

    Unanswered: 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

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    this is not an ANSI SQL question

    which database system are you using? the thread will have to be moved to the appropriate forum
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    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.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    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:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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???
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    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...

  7. #7
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

  8. #8
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    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)

  9. #9
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •