Re: writing to text file

From: George E. Gifford <george.gifford_at_dfrc.nasa.gov>
Date: Fri, 06 Jul 2001 12:04:25 -0700
Message-ID: <3B460BB9.A6BB8475_at_dfrc.nasa.gov>


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

Brian Janko wrote:

> 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
Received on Fri Jul 06 2001 - 21:04:25 CEST

Original text of this message