Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Extra white spaces in the spooled output file

Arun ManteAug 4 2011 — edited Aug 5 2011
Hi All,

I’m working on data extraction for which I’m spooling data. I’m using below sql to the spool
clear columns
set newpage 0
set pagesize 0
set echo off
set feedback off
set heading off
set linesize 256
set termout off
set space 0
SET TRIMSPOOL ON

whenever oserror exit failure;

spool $APPLDAT/XXXXXX.dat

col COL15  for 0999999999999.99
col COL16    for 0999999999999.99
col COL17    for 0999999999999.99
col COL18    for 0999999999999.99
col COL19    for 0999999999999.99
col COL20    for 0999999999999.99
col COL21     for 0999999999999.99
col COL22     for 0999999999999.99
col factor          for 0999.99999999
col zz              for a2
col yyyy            for a4


  SELECT   RPAD (COL1, 30),
           RPAD (COL2, 4),
           RPAD (COL3, 5),
           RPAD (COL4, 5),
           RPAD (COL5, 6),
           RPAD (COL6, 4),
           RPAD (COL7, 6),
           RPAD (COL8, 8),
           RPAD (COL9, 15),
           RPAD (COL101, 15),
           LPAD (COL11, 4, 0) yyyy,
           LPAD (COL12, 2, 0) zz,
           COL13,
           COL14,
           COL15,
           COL16,
           COL17,
           COL18,
           COL19,
           COL20,
           COL21,
           COL22,
           COL23 factor
    FROM   XXX_TABLE
ORDER BY   11,
           12,
           1,
           2,
           3,
           4,
           5,
           6,
           7,
           8,
           9
/

spool off
But there are extra white spaces in the extracted output file. I can not change the above sql format.

Database version is

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

Please guide me if someone has any idea on removing extra while spaces.

Thanks,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2011
Added on Aug 4 2011
12 comments
2,870 views