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: SQL*Plus: How can I write each record to a separate file

Re: SQL*Plus: How can I write each record to a separate file

From: <zrwcvhsosoik001_at_sneakemail.com>
Date: 8 Sep 2006 07:13:30 -0700
Message-ID: <1157724809.975320.150870@m79g2000cwm.googlegroups.com>


Well, the example is hypothetical of course. But UTL_FILE will not work, because I need the output on the client. We have no access to the server filesystem.

DA Morgan wrote:
> zrwcvhsosoik001_at_sneakemail.com wrote:
> > Hi,
> >
> > I need to select a set of records, and then write each record to a
> > separate file.
> > Something like this (in pseudo code). The idea is to write the salary
> > of each employee to a separate file with the name of the employee.
> >
> > FOR rec in select * from emp LOOP
> > create file with filename rec.ename
> > write rec.sal to file
> > close file
> > END LOOP
> >
> > Is this possible using SQL*Plus? Or would you recommend another tool.
> >
> > Thanks!
>
> Use UTL_FILE. You can find a demo of this in Morgan's Library at
> www.psoug.org. You will need to modify it, however, to create each
> individual file and name it.
>
> I wonder how well this has been thought out from the business
> requirements standpoint. You are going to end up with a lot of
> separate files sitting on the server (where no one should be mucking
> about) that will then need to be moved or further processed. Why not
> just go directly to whatever end result is desired?
> --
> Daniel Morgan
> University of Washington
> Puget Sound Oracle Users Group
Received on Fri Sep 08 2006 - 09:13:30 CDT

Original text of this message

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