Re: writing to text file

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sun, 22 Jul 2001 06:57:22 GMT
Message-ID: <9i5fds02ttg_at_drn.newsguy.com>


[Quoted] In article <3B463C8A.67467F0F_at_dfrc.nasa.gov>, "George says...
>
>Setting Colsep to a tab character and then spooling to a file does not, in my
>efforts, produce a proper tab-delimited file. Somewhere in the translation the
>results are the same as using the default for colsep. Even using -Set Tab On-
>will
>not produce the expected results. I could very well be missing something here,
>but
>I have only had success with using CHR(9) between fields, with and without using
>concatenation.
>

what is wrong with it?

$ od -c foo.lst

0000000                           7   3   6   9  \t   S   M   I   T   H
0000020                      \t   C   L   E   R   K                  \t
0000040                           7   9   0   2  \t   1   7   -   D   E
0000060   C   -   8   0  \t                               8   0   0  \t
0000100                                          \t                    
0000120               2   0  \n

tabs are all there?

>Thomas Kyte wrote:
>
>> In article <3B45D984.54F7C478_at_attws.com>, "Daniel says...
>> >
>> >"Andrei V. Kirilenkov" wrote:
>> >
>> >> hi
>> >> if you are using the standart SQL+ then use
>> >> spool file_name
>> >> Oracle will copy into file_name the SQL+
>> >> output Brian Janko <brian_at_jankoNOnet.SPAMcom.INVALID> wrote in message
>> >> news:0H517.2723$Pf4.313156_at_bin1.nnrp.aus1.giganews.com...
>> >> > How can I get the results of several SQLPlus queries to Oracle to write
>> >> > their results into a single tab-delimited text file?
>> >> >
>> >> > Thanks,
>> >> > Brian
>> >> >
>> >> >
>> >> >
>> >
>> >How do you spool a tab delimited file?
>> >
>> >Daniel A. Morgan
>> >
>>
>>well, one answer would be goto technet and look it up. Its right there in the
>> sqlplus guide ;)
>>
>> Another way would be to show you
>>
>> scott_at_8i> set colsep ' ' <<<=== thats a TAB in there
>> scott_at_8i> set heading off
>> scott_at_8i> set feedback off
>> scott_at_8i> set embedded on
>> scott_at_8i> set pagesize 10000
>> scott_at_8i> spool foo.csv
>> scott_at_8i> select * from emp;
>> scott_at_8i> spool off
>>
>> --
>> Thomas Kyte (tkyte_at_us.oracle.com) http://asktom.oracle.com/
>> Expert one on one Oracle, programming techniques and solutions for Oracle.
>> http://www.amazon.com/exec/obidos/ASIN/1861004826/
>> Opinions are mine and do not necessarily reflect those of Oracle Corp
>

--
Thomas Kyte (tkyte_at_us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Sun Jul 22 2001 - 08:57:22 CEST

Original text of this message