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: export table data to comma delimited text file

Re: export table data to comma delimited text file

From: <orauser_at_my-deja.com>
Date: 2000/06/03
Message-ID: <8haeta$4il$1@nnrp1.deja.com>#1/1

Thanks a lot for the help. Do you know how to write a generic routine that we could call with two arguments, like table_name, and exportfile_name, and it would do its thing, without having to code all the column names?

Thanks in advance..

In article <393899ba.11652996_at_172.16.7.5>,   violin.hsiao_at_mail.pouchen.com.tw (Violin) wrote:
> On Fri, 02 Jun 2000 21:58:32 GMT, orauser_at_my-deja.com wrote:
>
> try this :
>
> SQL> desc emp
>
> EMPNO NOT NULL NUMBER(4)
> ENAME VARCHAR2
 (10)
> JOB VARCHAR2(9)
> MGR NUMBER(4)
> HIREDATE DATE
> SAL NUMBER(7,2)
> COMM NUMBER(7,2)
> DEPTNO NUMBER(2)
>
> SQL> set head off
> SQL> set line 500
> SQL > set pagesize 500
> SQL> spool c:\temp\ascii.txt
> SQL> select rtrim(to_char(EMPNO)) || ',' ||
> 2 rtrim(ENAME) || ',' ||
> 3 rtrim(JOB) || ',' ||
> 4 rtrim(MGR) || ',' ||
> 5 to_char(HIREDATE,'yyyymmdd') || ',' ||
> 6 to_char(SAL) || ',' ||
> 7 to_char(COMM) || ',' ||
> 8 to_char(DEPTNO)
> 9 from emp
> 10 /
>
> 7369,SMITH,CLERK,7902,19801217,2180,,20
> 7499,ALLEN,SALESMAN,7698,19810220,1600,,30
> 7521,WARD,SALESMAN,7698,19810222,1250,,30
> 7566,JONES,MANAGER,7839,19810402,2600,,20
> 7654,MARTIN,SALESMAN,7698,19810928,1250,,30
> 7698,BLAKE,MANAGER,7839,19810501,2850,,30
> 7782,CLARK,MANAGER,7839,19810102,2450,,
> 7788,SCOTT,ANALYST,7566,19870419,3000,,20
> 7839,KING,PRESIDENT,,19811117,5000,,
> 7844,TURNER,SALESMAN,7698,19810908,1500,,30
> 7876,ADAMS,CLERK,7788,19870523,1100,,20
> 7900,JAMES,CLERK,7698,19811203,950,,30
> 7902,FORD,ANALYST,7566,19811203,3000,,20
> 7934,MILLER,CLERK,7782,19820123,1300,,
>
> SQL > spool off
>
> Violin.
> violin.hsiao_at_mail.pouchen.com.tw
>
> >Whats the easiest way to export a table's data to a comma
> >delimited text file?
> >
> >Thanks :-)
> >
> >
> >Sent via Deja.com http://www.deja.com/
> >Before you buy.
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Sat Jun 03 2000 - 00:00:00 CDT

Original text of this message

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