Re: exporting a table to a flat file in .csv format - CORRECTION!

From: TurkBear <john.greco_at_dot.state.mn.us>
Date: Tue, 26 Aug 2003 12:11:41 -0500
Message-ID: <sv4nkv8qeof4jvc1gjvgrb6vdi8ug7vmrt_at_4ax.com>


[Quoted] TurkBear <john.greco_at_dot.state.mn.us> wrote:

>"Jon" <aaa_at_bbb.ccc> wrote:
>
>>I am trying to dump data from a table to a flat file in .csv format. I have
>>read documentation for sqlplus utility but I have not seen any information
>>about this apart from defining specific format for columns. Do you know if
>>this is posible from sqplus?
>>
>>Thanks
>>
>Yes..
>Read up on spool and colsep and concatenate in the docs, but in general:
>
>set heading off
>set linesize 1000 ( or whatever)
>set pagesize 0
>set feedback off
>set colsep ','
>spool 'drive:\path\filename'
>select trim(field1)||trim(field2)||trim(field3)........
>from your table;
>
>have fun...
>
>
Oops..
Brain Freeze!

The use of concatenation eliminates the colsep character, so I should have used either:

[Quoted] select field1,field2,field3,etc...

OR

select trim(field1)||','||trim(field2)||','||trim(field3)||','||etc........

[Quoted] The first will retain the defined width of the data field and place a comma between each field, while the latter will trim [Quoted] training spaces and place a comma between the fields..

Sorry..... Received on Tue Aug 26 2003 - 19:11:41 CEST

Original text of this message