Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Utility for extracting table's data into flat file ?

Re: Utility for extracting table's data into flat file ?

From: Keith Boulton <boulke_at_globalnet.co.uk>
Date: 1997/11/19
Message-ID: <34728b37.1337813@read.news.global.net.uk>#1/1

On 18 Nov 1997 18:03:29 GMT, Shirley Donor <sdonor_at_cs.ucr.edu> wrote:

>
>
> Is there an Oracle Utility that can dump a table's data
> into a flat file ?
>
> Thank you very much.
>
>--

You can use sqlplus or pl/sql.

The following sqlplus command file will do the sort of thing required assuming that you require a text format file. If you require binary representation of numbers etc then it would get more tricky.

spool off
exit success

this file can be run with sqlplus / @<filename.sql> <tablename>

Alternatively, you can use PL/SQL file io functions which are significantly faster e.g.

create or replace procedure dumpf as
  f utl_file.file_type;
  cursor c is
    select rpad(to_char(a),11) || b x
    from bill
    order by a;
begin
  f := utl_file.fopen('d:\temp','test1.txt', 'w' );   for r in c loop

     utl_file.put_line( f, r.x );
  end loop;
  utl_file.fflush(f);
  utl_file.fclose(f);
end;
/

the above procedure is specific to a particular table. Received on Wed Nov 19 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US