pl/sql question - how to create multiple files- reg

From: RATHANB <rathanb_at_cs.com>
Date: 04 Apr 2000 03:50:55 GMT
Message-ID: <20000403235055.27825.00000744_at_ng-ba1.news.cs.com>



Hi all
[Quoted] I have to create 20-30 different flat files using UTL_FILE utility. I am looking for some good logic, how do I create 20-30 files dynamically.
For example, I have a main cursor which selects many departments and employess in those departments. For each department fetched I have to create a file with department name and employees, the problem is when I write code like below:
declare

       cursor c1 is select dept_no,emp_no from emp_master; begin

       for c1 in c1_cur 
       loop
           file_name = c1_cur.dept_no;
           create the file using UTL_FILE;
          write all the employee info into the file ;
           ?????
      end loop;

when there is dept change within the loop, firstly how do I understand it is different new dept_no compare to previous dept_no fectched, and then how do i create a second different dept_no file..and continue for the dept [Quoted] numbers fetched dynamically (it could be 1 or 20) with in the cursor. can I use any counters etc.,
I am looking for prefered logic to find how I understand it is different dept_no,
and proceed with creation of another dept_no file; I am aware of UTL_FILE stuff;only thing is logic to create many files depending on dept_no change; [Quoted] is that i need to create table and load the cursor values or give me a good suggestion.

Thanks
Rathan. Received on Tue Apr 04 2000 - 05:50:55 CEST

Original text of this message