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: A follow-up question with exporting table to a flat file

Re: A follow-up question with exporting table to a flat file

From: Ed Prochak <prochak_at_my-dejanews.com>
Date: Mon, 19 Apr 1999 14:02:51 GMT
Message-ID: <7ffd24$9b1$1@nnrp1.dejanews.com>


Does your C program on the Informix DB run the "unload" command using the system () call? Then why can't your Pro*C program on Oracle use something like:

         system("sqlplus @/somepath/myunload.sql >myOutputFile");

where myunload.sql is a simple query:

         select * from my_table;
         /

You will need other lines to turn of headings and such, but that's the idea. You can have the progam create the script at run time, OR have it as a static file. (A statis file has the advantage that you could change the query without changing the program. So if you added a column to the table, but did not want it in this case, just change the query to select the columns needed. No recompile!)

Doing it this way, you don't need a cursor. You don't even need Pro*C!!!

Any problem with that? It's the simplest that I can think of.

In article <7f87co$gu3$1_at_nnrp1.dejanews.com>,   oct1pm_at_hotmail.com wrote:
> Hi, folks I am also trying to export an oracle table to a ASCII flat file. I
> know from your previous postings that I can use SQLPLUS. But my process is
> part of of a Pro*C batch program that runs everyday. I realized that one of
> my options is to use a cursor that scroll through every row of the table and
> thus write to a file. Is there an easier way than that ? I used to work on
> Informix, where there is a command called "unload" that allows direct
> download to a flat file. Is there a similar thing in Oracle 7.3 ?
>
> thanks,
>
> Andrew
> from S.F.
>

--
Ed Prochak
Magic Interface, Ltd.
ORACLE services
440-498-3702

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Mon Apr 19 1999 - 09:02:51 CDT

Original text of this message

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