Re: writing to text file

From: George E. Gifford <george.gifford_at_dfrc.nasa.gov>
Date: Fri, 06 Jul 2001 12:05:36 -0700
Message-ID: <3B460C00.11C9DFD5_at_dfrc.nasa.gov>


"Daniel A. Morgan" wrote:

> How do you spool a tab delimited file?

You can spool to a tab-delimited file; however, you have to jump through a few hoops. The following will work for VARCHAR2, CHAR, NUMBER, and DATE datatypes. CHR(9) is the ascii code for a Hard Tab. Of course you will have to us SQL-Plus to turn off the headers, etc., that you do not want outputted to the file.:

spool somefiledirectory_and_name

select varchar2_field1||CHR(9)||

       TO_CHAR(date_field2, 'MM/DD/YY')||CHR(9)||
       TO_CHAR(number_field3,'999999999999990')
from schema.table;

spool off Received on Fri Jul 06 2001 - 21:05:36 CEST

Original text of this message