Re: Export to a ascii, tab delimited file

From: Jerry Bull <Gerald.Bull_at_fmr.com>
Date: 1998/12/03
Message-ID: <36669190.63DC9FCC_at_fmr.com>#1/1


You can do it directly in SQLPLUS. Try:

    set trimspool on;

Or, in vi, use

    1,$ s/ * $//g

Jerry.

KeyStroke (Jack L. Swayze Sr.) wrote:

> No one does. Oracle doesn't provide a way to turn those pesky extra spaces off. (Part of
> the Unix mentality, I guess.)
>
> Two things you can do to mitigate the consequences, though. 1) put an extra tab at the
> end. That way all the extra spaces goes into one final column which can be deleted once
> you import it into MS Excel. 2) Find yourself a C programmer that is always bragging that
> C is the only way to go, ask him to 'prove it' by coding a little C program that will
> strip all the extra spaces off the end of a line. If he is any good, it should only take
> him a day or two to code and test it and deliver it to you. (The one I goaded into this
> did it in half a day.) Then in your Unix scripts, always have the file post-processed by
> that little C program. I would include the C code here, but it was developed using my
> employers resources, and I need to be faithful to my employer.
>
> By the way, when the C programmer then brags that we need to do away with Oracle and use C
> and flat files to do everything, that is when you can spring the news on him that Oracle
> was coded in C.
>
> Fabian Bakker wrote:
>
> > Hi,
> >
> > I want to export data to a ascii, tab delimited file. The linesize is
> > set to 2000, because the final select statement will have lots more
> > columns.
> >
> > Now I use the following sql script:
> > SET LINESIZE 2000;
> > SPOOL C:\OUTPUT.TXT;
> > SELECT
> > RTRIM(OWNER||CHR(9)||TABLE_NAME||CHR(9)||TABLESPACE_NAME||CHR(9)||RTRIM(CLUSTER_NAME))
> >
> > FROM SYS.ALL_TABLES;
> > SPOOL OFF;
> >
> > The problem with this script is that their are numerous spaces at the
> > back of each line, Those trailing spaces must be trimmed. I don't know
> > how to do that.
> >
> > Thanx in advance,
Received on Thu Dec 03 1998 - 00:00:00 CET

Original text of this message