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!

SPOOL TRIM COLUMN

469875Sep 27 2006 — edited Nov 13 2006
HI ALL,

on my DIRECTORY table i have defined:
FNAME VARCHAR2(20)
LNAME VARCHAR2(20)
ADDRESS VARCHAR2(60)


i have a script to spool data into a CSV file.

-------------------------------------------------------------------------
SET COLSEP ','

SPOOL sample.csv
select FNAME, LNAME, ADDRESS
from DIRECTORY;
SPOOL OFF;
-------------------------------------------------------------------------

and iv got this result on my sample.csv file:

-------------------------------------------------------------------------
John<so many spaces> ,Smith<so many spaces> ,Mouse Drive<so many spaces>
Lance<so many spaces> ,Depuche<so many spaces> ,Cultu Avenue<so many spaces>
-------------------------------------------------------------------------


how can i trim all the columns to eliminate the spaces?
my spool file should have:
John,Smith,Mouse Drive
instead of:
John<so many spaces>,Smith<so many spaces>,Mouse Drive<so many spaces>

Thanks!
BROKEN
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2006
Added on Sep 27 2006
18 comments
37,518 views