Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: newbie: simple sql query to create .csv file for excel import
A copy of this was sent to Volker Peter <vol_at_step.de>
(if that email address didn't require changing)
On Thu, 12 Aug 1999 10:52:53 +0200, you wrote:
>Hello you all out there,
>
>i'm new with Oracle SQL programming and i have a simple SQL Question:
>
>I must run a select statement on my Adress-Table and write down this
>data to a .csv file for importing this into winword or excel for working
>with that data.
>I read some documentation about Oracle Export but this seems to me that
>this won't work as i expected it to work. If you have any comments or
>ideas regarding this problem, please let me know - also if there is a
>internet website or a usergroup website where some example coding is
>shown to me so that i can learn from that sql code.
>
>If you have any ideas please let me know.
>
>Thank you !
>
>Volker
If you goto the link in my signature below, I have some scripts for unloading data using sqlplus.
If you get them -- the 'flat' scripts will unload the data to a flat file, separated by TABS (chr(9)). If you modify this script slightly to use a chr(44) (comma), you'll get a nice csv file. After I made the modifications I was able to:
D:\sqlstuff>flat scott/tiger_at_aria emp > emp.csv
D:\sqlstuff>type emp.csv
7369,SMITH,CLERK,7902,17-DEC-80,800,,20 7499,ALLEN,SALESMAN,7698,20-FEB-81,1600,900,30 7521,WARD,SALESMAN,7698,22-FEB-81,1250,500,30 7566,JONES,ANALYST,7839,02-APR-81,2975,,20 7654,MARTIN,SALESMAN,7698,28-SEP-81,1250,1400,30 7698,BLAKE,MANAGER,7839,01-MAY-81,2850,,30 7782,CLARK,MANAGER,7839,09-JUN-81,2451,,10 7788,SCOTT,ANALYST,7566,09-DEC-82,3000,,20 7839,KING,PRESIDENT,,17-NOV-81,5000,,10 7844,TURNER,SALESMAN,7698,08-SEP-81,1500,0,30 7876,ADAMS,CLERK,7788,12-JAN-83,1100,,20 7900,JAMES,CLERK,7698,03-DEC-81,950,,30 7902,FORD,ANALYST,7566,03-DEC-81,3000,,20 7934,MILLER,CLERK,7782,23-JAN-82,1300,,10
which loaded up into excel nicely.
--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Aug 12 1999 - 06:18:53 CDT
![]() |
![]() |