Re: How to dump table to field delimited ASCII file?

From: Mark D Powell <mark.powell_at_eds.com>
Date: 19 Sep 2001 07:05:49 -0700
Message-ID: <178d2795.0109190605.4672ab4f_at_posting.google.com>


allanwtham_at_yahoo.com (godmann) wrote in message news:<95cd51c.0109101837.36b8a2ae_at_posting.google.com>...
> Hi there,
>
> Try the code below:
> -----
>
> set trimspool on
> set termout off pages 0 heading off echo off
> set verify off feedback off
> set line 130
> spool emp.dat
> select
> '"' || replace(EMPNO,'"') ||'",' ||
> '"' || replace(ENAME,'"') ||'",' ||
> '"' || replace(JOB,'"') ||'",' ||
> '"' || replace(MGR,'"') ||'",' ||
> '"' || replace(HIREDATE,'"') ||'",' ||
> '"' || replace(SAL,'"') ||'",' ||
> '"' || replace(COMM,'"') ||'",' ||
> '"' || replace(DEPTNO,'"') ||'"'
> from scott.emp
> /
> spool off
> -----
>
> Say you have few tables to be output, hardcode the fields is fine. Otherwise,
> you will have to be smarter namely grab the all the tables and all the fields
> and output to different files respectively.
>
> Allan W. Tham
> DBA
Why hardcode when you can generate the list using simle SQL: See "How do I export a database table to a flat file ?" at the commom FAQ: url = http://www.jlcomp.demon.co.uk/faq/flatfile.html

  • Mark D Powell --
Received on Wed Sep 19 2001 - 16:05:49 CEST

Original text of this message