Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005
    Posts
    25

    Unanswered: Keep Column Headers, but, Set Heading Off...

    What I am doing is spooling my output to a text file using:

    SET HEADING OFF

    SPOOL D:\<path>\<filename>.txt

    SELECT...

    SPOOL OFF

    Then I read into Excel as fixed width. I would prefer space or comma delimitted. I know everyone has seen this question too many times, but, I'm just another newbie.

    I Don't want to echo the Select Statement into my output, but, I do want the Column Headers. I don't want new column headers every 1000 lines.

    If I say "SET PAGESIZE 0" then I lose column Headers. If I say "SET HEADING OFF" I lose Column Headers.

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    two ways

    set pagesize 50000 (for example)
    or

    set heading off
    set linesize 4000
    set trimspool on
    SPOOL D:\<path>\<filename>.txt

    select 'column1,column2,column3,column4'
    from dual
    union all
    SELECT column1||','||column2||','||column3||','||column4
    from mytable;

    SPOOL OFF
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

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