Re: sql*plus column format remove whitespace

From: Ed prochak <ed.prochak_at_magicinterface.com>
Date: 5 Nov 2004 10:34:48 -0800
Message-ID: <4b5394b2.0411051034.5923f392_at_posting.google.com>


alok_bisani_at_yahoo.com (Alok Bisani) wrote in message news:<f28905db.0411040850.58848d7a_at_posting.google.com>...
> ed.prochak_at_magicinterface.com (Ed prochak) wrote in message news:<4b5394b2.0411021016.562edc9b_at_posting.google.com>...
> > Please bottom post.
> Sorry, I am new to usenet, I thought the etiquette was to top post.
> Atleast thats what I do in email.
>
>
In email, the recipient usually knows the context. Someone just joining this newsgroup might not have the history of the thread available. Bottom posting allows reviewing the context in the order it was written.
[bunch of old stuff deleted]
> > Why do you think you need to TRIM the data?
> > If you are producing a CSV file, who cares about trailing
> > whitespace? That's an issue for the loader to deal with.
> Not if you are going to send the output in a CSV file email attachment
> for a viewing and using in Excel.

I had not realized that. Whenever I loaded such output into Xcel, I used fixed sized columns, which trim the trailing spaces. I just tested and you are right, give Xcel a csv file and it loads it WITH the trailing spaces.
>
>
> >
> > If you know the max length of your output DATA , then you can use the
> > TRUNCATE option on the COLUMN command to minimize the trailing spaces.
>
> TRUNCATE option would not remove the trailing space after all columns.
> I need a specific column format to not pad the column data with
> trailing whitespace. As far as I have searched there is nothing
> available which I could find.

Yes, I think you are stuck, as far as using SQL*Plus. You'll have to do a little post processing to trim things up. A sed or PERL srip should do it without much trouble.
>
> >
> > Or use the combination of COLSEP and TRIM()
> >
> > SET COLSET ','
> > SELECT RTRIM(cola) columnone, RTRIM(colb) columntwo
> > FROM yourtable ;
> >
> > should do as you need.
> Again these work on the actual data, but do not control the SQL*PLUS
> output display
>
>
> >
> > Ed
>
> cheers,
> Alok.

Sorry I didn't solve your problem. I've just used fixed field size loads so much I forgot how stubborn SQLPLUS could be.

Have a good day.
  ed Received on Fri Nov 05 2004 - 19:34:48 CET

Original text of this message