Re: Sending the output to a comma delimited file

From: Teus van Lingen <nospam.tvlingen_at_sql-integrator.com>
Date: Thu, 28 Jan 1999 15:20:55 -0400
Message-ID: <36B0B896.BF4BAF6B_at_sql-integrator.com>


the easiest way is to set colsep to ',' in sqlplus and run your query.

You may alternatively include the commas in your select statement like in:

              select column1
                     , ','
                     , column2
                     , ','
                     , ....
                     , ','
                     , columnx
                  from your_table;

This will produce output in which values are delimited with " , " becasue oracle will include a space after every field. You can override this by setting colsep to ''. Another way to get rid of the space would be to strip them with any stream-editor.

Of course, you could convert any non-character field to a character value and concatenate everything into a long string. Beware though, that Oracle will default include a space in place of a '+' sign in front of any positive number!

Yours
Teus

hazela_at_mar.dfo-mpo.gc.ca wrote:

> I am running a script through SQL*PLUS to send the output to a comma
> delimited file, so I may open it in excel without it wrapping itself (too
> long)
>
> How do I specify commas after my fields?
>
> Thanks anyone!
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Thu Jan 28 1999 - 20:20:55 CET

Original text of this message