Re: Easy way to dump table to flat file?

From: Noah Monsey <noah_at_indirect.com>
Date: Sun, 26 Feb 1995 18:08:30 GMT
Message-ID: <D4MD27.AFI_at_indirect.com>


Here is an example script that you can modify. If you use Roel's explanation it should be easy to understand.

#########Begining of example###############################################

set feedback off
set echo off
set heading off
set pagesize 0
set linesize 154
set flush off
set recsep off
set space 0
set tab on
set trimout on

column code format 999
column name format a40
column address format a40
column city format a40
column phone format a12
column fax format a12

spool ac.txt
select
code,name,address,city,phone,fax
from accounts
order by code;
exit

#########End of example###############################################

Roel Eckhardt (re_at_albast.knoware.nl) wrote:
: In article <3hu6kr$924_at_linus.mitre.org>, vv_at_mbunix (Vincent A Ventrone) says:
: >
: >A colleague has asked me to describe the easiest way to dump
: >an Oracle table to a flat Unix file--and I did not have a ready answer.
: >
 

: The easiest way to do this is using SQL*Plus and the 'spool'
: command , which captures all the screen output to a named file.
 

: in SQL*Plus:
: 1. first open a spool file:
: SPOOL <filename>
: 2. Select the required fields (probably all) from the table with
: the SQL select statement.
: SELECT * FROM ....
: 3. close spool file:
: SPOOL OFF
 
: In order to make your spoolfile look more like a data flat-file
: specify some setting first in SQL*Plus, like:
: - SET SPACE 0 (set field spacing from 1 (default) to zero)
: - SET LINESIZE <#> (total # of characters of all the fields = record size)
: - SET HEADING OFF (eliminates the column headings)
: - SET FEEDBACK OFF (eliminates the '# rows selected' remark)
 

|...................................................................|
|The only dumb question is the one that you don't ask               |
|.............................................. sig version .95 beta|
|Noah Monsey        Oracle Master  Database Administration  April 92|  
|noah_at_indirect.com Oracle Master Application Development April 92| Received on Sun Feb 26 1995 - 19:08:30 CET

Original text of this message