Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: -> Write table data to a text file? How? <-
Here is an example script that I use to extract data from a table with varchar2 datatypes into a fixed length file of 44 characters:
rem ******************************************************** rem * Function: Extract the rawmatl_xref table to flat file rem * Author: Frank Thomas
rem ********************************************************
prompt Extracting RAWMATL_XREF table data...
set heading off
select to_char(sysdate, 'YY/MM/DD HH24:MI:SS') from dual;
set echo off
set showmode off
set verify off
set pagesize 0
set space 0
set feedback off
set heading off
set wrap off
set timing off
set pause off set wrap on
set feedback off
set linesize 44
spool rawmxref.txt
select rpad(source_system_id,10,' ') || rpad(source_rawmatl_id,10,' ') || rpad(rawmatl_id,18,' ') || rpad(sap_system,6,' ')
spool off
prompt Complete...
set heading off
select to_char(sysdate, 'YY/MM/DD HH24:MI:SS') from dual;
set heading on
exit
Les Gainous <lesgainous_at_earthlink.net> wrote:
>To all,
>What's the best way to write data out to a text file: comma-delimited,
>tab-separated, or fixed length? I basically need to write out a table
>into a format usable by other RDMSs/applications. I'm looking for
>something similar to the Bulk-Copy Program from Sybase or Microsoft SQL
>Server.
>Thanks in advance!
>--
> Les Gainous, lesgainous_at_earthlink.net
> Visit my web page at
> http://home.earthlink.net/~lesgainous
> Looking for a Client-Server job in California?
> http://home.earthlink.net/~lesgainous/jobs.html
Frank Thomas
thomasf_at_daugherty.com
Received on Thu Oct 31 1996 - 00:00:00 CST
![]() |
![]() |