What Is the Quickest Way to Export a Table to a Flat File

Q

What Is the Quickest Way to Export a Table to a Flat File? - Oracle DBA FAQ - Loading and Exporting Data

✍: FYIcenter.com

A

The quickest way to export a table to a flat file is probably to use the SQL*Plus SPOOL command. It allows you to record SELECT query result to a text file on the operating system. The following tutorial exercise shows you how control the output format, start the spooler, and dump all record from a table to a flat text file:

>mkdir \oraclexe\test
>sqlplus /nolog

SQL> connect HR/fyicenter

SQL> SET HEADING OFF;
SQL> SET FEEDBACK OFF;
SQL> SET LINESIZE 1000;
SQL> SPOOL \oraclexe\test\employees.txt;
SQL> SELECT * FROM EMPLOYEES;
......
SQL> SPOOL OFF;

You should get all records in employees.txt with fixed length fields.

2007-04-30, 4723👍, 0💬