PDA

View Full Version : Need direction on multiple cursor output from UTL_FILE


Guest
09-14-2005, 06:24 AM
I was hoping someone can answer a couple of questions about some Oracle
packages, so that I can figure out which is the best approach to a
problem.

We need to output multiple files of CSV data that is derived from an
Oracle table. IE. 5000+ separate files with its own data. I have been
able to use UTL_FILE to create one file with CSV data, but the lines
only represent the header information.

My questions are:
1. Can UTL_FILE be used to output and individually save multiple files
(so far everything I've seen in example code shows output to one file)?

2. Can a ref cursor be used in UTL_FILE? The data in my table has
multiple detail lines for each parent record/person header. Each of
the multiple saved files will have information for only one grouping of
records.

There may be a better approach to this task; please give me ideas. If
anyone can point me in the right direction, I would appreciate it.

Thanks,
Brenda

IANAL_VISTA
09-14-2005, 06:58 AM
"brenda.streed@empireblue.com" <brenda.streed@empireblue.com> wrote in
news:1126707890.495876.91420@g14g2000cwa.googlegroups.com:
I was hoping someone can answer a couple of questions about some Oracle packages, so that I can figure out which is the best approach to a problem. We need to output multiple files of CSV data that is derived from an Oracle table. IE. 5000+ separate files with its own data. I have been able to use UTL_FILE to create one file with CSV data, but the lines only represent the header information. My questions are: 1. Can UTL_FILE be used to output and individually save multiple files (so far everything I've seen in example code shows output to one file)? 2. Can a ref cursor be used in UTL_FILE? The data in my table has multiple detail lines for each parent record/person header. Each of the multiple saved files will have information for only one grouping of records. There may be a better approach to this task; please give me ideas. If anyone can point me in the right direction, I would appreciate it. Thanks, Brenda

I suggest you visit
http://asktom.oracle.com
and do a keyword search on UTL_FILE.
Tom has many, many fine coding examples.

DA Morgan
09-14-2005, 07:12 AM
brenda.streed@empireblue.com wrote: I was hoping someone can answer a couple of questions about some Oracle packages, so that I can figure out which is the best approach to a problem. We need to output multiple files of CSV data that is derived from an Oracle table. IE. 5000+ separate files with its own data. I have been able to use UTL_FILE to create one file with CSV data, but the lines only represent the header information. My questions are: 1. Can UTL_FILE be used to output and individually save multiple files (so far everything I've seen in example code shows output to one file)? 2. Can a ref cursor be used in UTL_FILE? The data in my table has multiple detail lines for each parent record/person header. Each of the multiple saved files will have information for only one grouping of records. There may be a better approach to this task; please give me ideas. If anyone can point me in the right direction, I would appreciate it. Thanks, Brenda

Yes.

Demos in Morgan's Library under UTL_FILE at www.psoug.org.
--
Daniel A. Morgan
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)

Guest
09-16-2005, 04:54 AM
DA Morgan wrote: brenda.streed@empireblue.com wrote: I was hoping someone can answer a couple of questions about some Oracle packages, so that I can figure out which is the best approach to a problem. We need to output multiple files of CSV data that is derived from an Oracle table. IE. 5000+ separate files with its own data. I have been able to use UTL_FILE to create one file with CSV data, but the lines only represent the header information. My questions are: 1. Can UTL_FILE be used to output and individually save multiple files (so far everything I've seen in example code shows output to one file)? 2. Can a ref cursor be used in UTL_FILE? The data in my table has multiple detail lines for each parent record/person header. Each of the multiple saved files will have information for only one grouping of records. There may be a better approach to this task; please give me ideas. If anyone can point me in the right direction, I would appreciate it. Thanks, Brenda Yes. Demos in Morgan's Library under UTL_FILE at www.psoug.org. -- Daniel A. Morgan http://www.psoug.org damorgan@x.washington.edu (replace x with u to respond)

Guest
09-16-2005, 04:58 AM
Thanks to everyone for their answers....One other question...can
UTL_FILE be used with CURSOR EXPRESSIONS or with EXECUTE IMMEDIATE with
BULK BINDING (our database is server v ersion 9.2.0.6).

Thanks,
Brenda

DA Morgan
09-16-2005, 07:29 AM
brenda.streed@empireblue.com wrote: Thanks to everyone for their answers....One other question...can UTL_FILE be used with CURSOR EXPRESSIONS or with EXECUTE IMMEDIATE with BULK BINDING (our database is server v ersion 9.2.0.6). Thanks, Brenda

Define what you mean by "used with."
--
Daniel A. Morgan
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)


MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service