I have a query that returns a lot of data in a CSV file. In fact, that Excel cannot open it, there are too many rows. Is there a way to control spoolto buffer a new file every time 65,000 lines are processed? Ideally I would like to have its output to a file named in sequence, such as large_data_1.csv, large_data_2.csv, large_data_3.csv, etc.
I could use dbms_outputin a PL / SQL block to control the number of rows, but then how would I switch files, since spoolit doesn't seem to be accessible from PL / SQL blocks?
(Oracle 10g)
UPDATE:
I do not have access to the server, so writing files to the server will probably not work.
UPDATE 2:
Some of the fields contain free-form text, including lines, so counting line breaks AFTER the file is written is not as simple as counting WHILE records when data is returned ...
source
share