Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: export table data to comma delimited text file
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)
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.
Received on Sat Jun 03 2000 - 00:00:00 CDT
![]() |
![]() |