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: using sqlldr to extract the content of table to a file

Re: using sqlldr to extract the content of table to a file

From: Wilfrid <grille11_at_yahoo.com>
Date: Mon, 2 Oct 2006 14:45:53 +0200
Message-ID: <45210a01$0$32516$636a55ce@news.free.fr>


Thanks all for your help.
I tried this:

    from dos:
SQLPLUSW.EXE scott/tiger_at_host @D:\script.sql

    script.sql:
SET LINESIZE 2000
set colsep ,

spool D:\file.txt
select * from emp;
spool off;
exit

The result is odd, i have a header with the columns title separated by commas then a line with ------ and then11 lines of data and again the header and so on.
It seems also to be size delimited

     EMPNO,ENAME     ,JOB      ,       MGR,HIREDATE ,
----------,----------,---------,----------,---------,
      7369,SMITH     ,CLERK    ,      7902,17-DEC-80,

Is there a way to remove the header and the ---- separation? also to remove this size delimitation?
in a way to have only:

7369,SMITH,CLERK,7902,17-DEC-80, Thanks

"gazzag" <gareth_at_jamms.org> wrote in message news:1159355470.870247.152740_at_h48g2000cwc.googlegroups.com...
> Wilfrid wrote:
>> Hello,
>>
>> I am using Oracle 9.2.0.1.
>> I would like to extract the content of a table to a csv file. I am
>> already
>> using a bit sqlldr to load data into the DB and I was wondering if the
>> other
>> way around is possible?
>> Or may be there is another way/tool for doing this.
>> Thanks for your help
>> Wilfrid
>
>>From within SQL*Plus:
>
> SQL> set colsep ,
> SQL> spool <filename>
> SQL> select * from <table_name>;
> SQL> spool off
>
> HTH
> -g
>
Received on Mon Oct 02 2006 - 07:45:53 CDT

Original text of this message

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