Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2009
    Posts
    55

    Unanswered: format the file by command spool

    Hi,
    I use sqplus in oracle to output the command output to text file .

    I use below set environment varialble.

    SQL> set echo off;
    SQL> set linesize 3999;
    SQL> set feedback off;
    SQL> set feedback off;
    SQL> set termout off;
    SQL> set pagesize 0;
    SQL> spool mapping.txt
    select C_SIM_MSISDN,C_SIM_IMSI from RCA_SMART_CARD order by C_SIM_MSISDN;


    In ouput file , it look like

    SQL> select C_SIM_MSISDN,C_SIM_IMSI from RCA_SMART_CARD order by C_SIM_MSISDN;
    060010007 10007
    :
    :
    :
    SQL> spool off;


    any setting or command that allow me to remove
    the first sql command line" SQL>select XXXX"
    and the last command "SQL>spool off" after start up the "spool mapping.txt"

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    the following might help

    sqlplus -s username/password

    then again, it might not do what you desire.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2009
    Posts
    55
    Quote Originally Posted by anacedent View Post
    the following might help

    sqlplus -s username/password

    then again, it might not do what you desire.
    I only want to the output file mapping .txt remove the first line and last line .
    That mean the first line "SQL>select XXX " and last line "SQL>spool off" is removed in output file .
    But I do not want to use editor as the file is too big ....

    Any sql command and setting can do this ???

  4. #4
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    set echo off is only used if you are running a script, it is ignored if you are interactively typing in the commands.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  5. #5
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Wink

    Put all commands and your query in a script file (MyQueryReport.sql), then just execute:
    Code:
    SQL> @MyQueryReport
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

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