Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004
    Posts
    19

    Unanswered: Sqlplus output to text file truncates spaces in Shell script

    Hi,

    I am trying to send output to a flat file using following code. Last column has 3 spaces (NOT NULL). When I use spool or run the same commands from sqlplus it works fine, but when I put this code in shell script, output gets truncated to the second column (it does not give 3 spaces at the end).

    Any help would be greatly appreciated.


    ---- Code Start
    PLSQL_MSG=`$SQLPLUS -S $DB_LOGON << EOF > $SPOOL_FILE
    whenever oserror exit 1;
    whenever sqlerror exit 1;
    set heading off;
    set pagesize 0;
    set feedback off;
    set colsep ' '; -- tab seperator
    select col1, col2, col3 from table1;
    exit;
    EOF`
    ------- Code End

    Thanks,

    Jagannath Dalvi

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    SET TRIM[OUT] {ON|OFF}
    SET TRIMOUT is not supported in iSQL*Plus

    Determines whether SQL*Plus allows trailing blanks at the end of each displayed line. ON removes blanks at the end of each line, improving performance especially when you access SQL*Plus from a slow communications device. OFF allows SQL*Plus to display trailing blanks. TRIMOUT ON does not affect spooled output.

    SET TRIMS[POOL] {ON|OFF}
    SET TRIMSPOOL is not supported in iSQL*Plus

    Determines whether SQL*Plus allows trailing blanks at the end of each spooled line. ON removes blanks at the end of each line. OFF allows SQL*Plus to include trailing blanks. TRIMSPOOL ON does not affect terminal output.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

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

    Talking

    Try using:
    Code:
    set lin 80 trims off trim off
    set head off page 0 feed off
    set tab off --instead of colsep!
    If you use tabs as column separators, the size of output line will be less!
    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
  •