Load data to flat file from table.

Hi all,

I need to know how to copy data from a table say ABC to a flat file say XYZ.dat in unix,

Please leave ur comments and the fastest way to do so,

I need to load the table records into flat file.

Regards
Ann

Oracle ? Sybase?

Oracle 8i

one way

echo "
set pages 0
set linesize 1000
set feedback off
spool xyz.lis
select * from abc;
spool off 
exit
" | sqlplus -s username/password@oracledb 

You have to adjust the set linesize value to what matches the width of a table row.

A slight modification to Jim's reply as the password should NOT be visible on the command prompt:

CONNECT_STRING=username/password@sid
sqlplus -s /nolog << EOF
conn ${CONNECT_STRING}
spool flatfile.txt
select * from tablename;
spool off
EOF

HTH, :cool:

Regards,

Praveen