Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: newbie: simple sql query to create .csv file for excel import

Re: newbie: simple sql query to create .csv file for excel import

From: Sebastien REMARK <sebastien.remark_at_eurocontrol.fr>
Date: Thu, 12 Aug 1999 13:49:51 +0200
Message-ID: <37B2B4DF.6A69FA02@eurocontrol.fr>


Volker Peter 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

As far as I know, you have two different solutions :

  1. Use simple SQL statement and SQL*Plus using the spool command of SQL*Plus. Example : Table_1 contains the columns a and b.

spool results.csv
select a||','||b from table_1;

2) Use PL/SQL Programming with the package UTL_File to write anything you want in a file.

Example :

declare

cursor query is
select a,b from table_1;

begin

end;

Hope it helps.

Sebastien. Received on Thu Aug 12 1999 - 06:49:51 CDT

Original text of this message

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