Hi Experts,
I have a table which contains 360 records and want to create multiple files with each file containing 12 records.
I tried to use the below code, however was unsuccessfull..
Please help!!!!
DECLARE
num NUMBER := 1;
f_file UTL_FILE.file_type;
row_sm NUMBER := 0.00;
CURSOR c_cur
IS
SELECT customer_key, all_columns_concat
FROM demo;
c_rec c_cur%ROWTYPE;
BEGIN
OPEN c_cur;
LOOP
FETCH c_cur
INTO c_rec;
EXIT WHEN c_cur%NOTFOUND;
WHILE num = c_rec.file_num
LOOP
f_file := UTL_FILE.fopen ('DM_DIR', 'FILE_' || num, 'w', 3267);
num := num + 1;
END LOOP;
UTL_FILE.put_line (f_file, c_rec.all_columns_concat);
row_sm := c_rec.sum_row + row_sm;
END LOOP;
UTL_FILE.fclose (f_file);
CLOSE c_cur;
END;
Regards,
RaviR.