Home » RDBMS Server » Server Administration » Copying data from table to a text file (sqlplus)
Copying data from table to a text file (sqlplus) [message #374930] Thu, 12 July 2001 05:37 Go to next message
AK
Messages: 7
Registered: July 2001
Junior Member
Is there any way to copy data from a table to a text file using sqlplus commands? I have previously used CA-Ingres databases and in Ingres the trick was done like this:

COPY TABLE tablename
( columnname = format [[WITH NULL (value)]]
{, columnname = format [[WITH NULL (value)]] } )
INTO | FROM 'file_specification'
WITH with_clause

Is there a similar command or any other way to do this with sqlplus? I need to get all the data from the table to a text file (not just one row).
Re: Copying data from table to a text file (sqlplus) [message #374944 is a reply to message #374930] Thu, 12 July 2001 13:37 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
set pagesize 0
set linesize 1000
set trimspool on
set echo off
set colsep ','
spool temp.txt
select * from tab;
spool off

your output is in temp.txt
Previous Topic: How to get a date dependend product price
Next Topic: Neg. logic in SQL
Goto Forum:
  


Current Time: Wed Jul 03 02:46:08 CDT 2024