Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Lost last space
On Nov 8, 5:09 pm, gazzag <gar..._at_jamms.org> wrote:
> On 8 Nov, 20:13, "astalavista" <nob..._at_nowhere.com> wrote:
>
>
>
>
>
> > Hi,
>
> > I have a table with the last column
> > with only one space
> > I try to generate a CSV
>
> > set colsep '$'
> > set linesize 500
> > => a lot of space at the end of record
> > set trimspool on
> > => no space at the end of a record
>
> > How can I get a CSV
> > with exactly one space at the end of a record ?
> > (as it is in the table)
>
> > Thanks for your help
>
> I've just re-read your post. CSV stands for Comma Separated Values.
> i.e. Each field is delimited by a comma (","). Do I understand you
> correctly?
>
> -g- Hide quoted text -
>
> - Show quoted text -
Since a trimspool will remove all trailing spaces including the one you want how about using case or decode to write out a constant to represent the space then feed the output into sed or another utility or script to replace the single constant in the last position of a line with a space.
Note if you will be using sqlldr to reload this file into another Oracle db you can use the sqlldr control file to perform the substitution of space for the constant.
HTH -- Mark D Powell -- Received on Thu Nov 08 2007 - 17:58:25 CST
![]() |
![]() |