Re: Exporting tables to external ASCII files

From: Eugene Freydenzon <efreydenzon_at_corpinfo.com>
Date: 1996/09/30
Message-ID: <32505F23.3602_at_corpinfo.com>#1/1


Ed DeNaro wrote:
>
> Does anyone know of a way to export data from Oracle 7.1 to external
> ASCII files? SQL*Loader is able to import but not export and
> the Export utilitiy only creates Oracle dump files. I understand there
> is a new PL/SQL proc in Oracle 7.3 to write to files on the operating
> system but nothing similiar in 7.1. Just wanted to find out how others
> have accomplished this task in versions prior to 7.3.
>
> Thanks,
> Ed DeNaro
> edenaro_at_fourthtier.com
Something like this:
sqlplus username/password_at_TNS
set echo off
set feedback off
set arraysize 1
set heading off
set pagesize 0
set linesize 2000

spool c:\spool.dat
select
Field1||','||

Field2||','||                          
....                                                                    
Fieldn              

from table;
spool off

{set everything back}
exit

where select statement can be created from cols view: select column_name||'||'',''||'
from cols
where table_name='TABLE_NAME'
order by column_id;
for full table columns.

As a result you'll have comma-separated list avalable for loading. Make shure linesize is set up correctly.

Hope it helps,

Eugene.

-- 
********************************************************
*        Everything above is only my opinion           *
********************************************************
*						       *
* If you see a lion in a cage and sign says "elephant" * 
*                      ,                               *
*           DO not belive your eyes !                  *
*       (Kozma Prutkov. (informal translation))        *
*                                                      *
********************************************************
Received on Mon Sep 30 1996 - 00:00:00 CEST

Original text of this message