Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: generating a text file of a table
Thanks Jay,
I've got that working fine as command line entries but I can't get it
to run as a script. Do you know the URL of an idiot's guide to
writing and running scripts (I'm a total Oracle novice).
Ultimately I want to be able to create csv files from a C++
application.
I'm surprised that an established product like Oracle hasn't got a
simpler method of generating text files of data.
Tim
In article <3A3930A3.1AC74F61_at_pixar.com>,
Jay Weiland <jay_at_pixar.com> wrote:
>
> --------------C3B6EDDC5C57E2489F4CA059
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Hey Tim,
>
> If you just want text and fixed width will do it for you:
>
> SQL> spool c:\temp\table_text.txt
> SQL> select * from your_table_name;
> .
> .
> .
> SQL> spool off
>
> And you will have a simple text file with the output. If you
need CSV one solution would be change the select to:
>
> SQL> select field1 || ',' || feild2 || ',' || feild3 || ',' || field4
from your_table_name;
>
> Jay!!!
>
> tshbedford_at_my-deja.com wrote:
>
> > Oops, I thought my first message had failed to up load. Sorry for
repeating
> > myself.
> >
> > Tim
> >
> > In article <91ab3b$h16$1_at_nnrp1.deja.com>,
> > tshbedford_at_my-deja.com wrote:
> > > Can anyone tell me how to generate a simple text file (csv) of a
table's
> > > contents? thanks
> > >
> > > Tim
> > >
> > > Sent via Deja.com
> > > http://www.deja.com/
> > >
> >
> > Sent via Deja.com
> > http://www.deja.com/
>
> --------------C3B6EDDC5C57E2489F4CA059
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Hey Tim,
> <p> If you just want text and fixed width will
> do it for you:
> <p><tt>SQL> spool c:\temp\table_text.txt</tt>
> <br><tt>SQL> select * from your_table_name;</tt>
> <br><tt>.</tt>
> <br><tt>.</tt>
> <br><tt>.</tt>
> <br><tt>SQL> spool off</tt>
> <p> And you will have a simple text file with
the
> output. If you need CSV one solution would be change the select
to:
> <p><tt>SQL> select field1 || ',' || feild2 || ',' || feild3 || ',' ||
field4
> from your_table_name;</tt>
> <p>Jay!!!
> <p>tshbedford_at_my-deja.com wrote:
> <blockquote TYPE=CITE>Oops, I thought my first message had failed to
up
> load. Sorry for repeating
> <br>myself.
> <p>Tim
> <p>In article <91ab3b$h16$1_at_nnrp1.deja.com>,
> <br> tshbedford_at_my-deja.com wrote:
> <br>> Can anyone tell me how to generate a simple text file (csv) of a
> table's
> <br>> contents? thanks
> <br>>
> <br>> Tim
> <br>>
> <br>> Sent via Deja.com
> <br>> <a href="http://www.deja.com/">http://www.deja.com/</a>
> <br>>
> <p>Sent via Deja.com
> <br><a
href="http://www.deja.com/">http://www.deja.com/</a></blockquote>
> </html>
>
> --------------C3B6EDDC5C57E2489F4CA059--
>
>
Sent via Deja.com
http://www.deja.com/
Received on Fri Dec 15 2000 - 03:36:15 CST