SQLPlus - spooling to multiple files from PL/SQL blocks

Posted by FrustratedWithFormsDesigner on Stack Overflow See other posts from Stack Overflow or by FrustratedWithFormsDesigner
Published on 2010-04-13T13:56:30Z Indexed on 2010/04/13 14:03 UTC
Read the original article Hit count: 692

Filed under:
|
|
|

I have a query that returns a lot of data into a CSV file. So much, in fact, that Excel can't open it - there are too many rows. Is there a way to control spool to spool to a new file everytime 65000 rows have been processed? Ideally, I'd like to have my output in files named in sequence, such as large_data_1.csv, large_data_2.csv, large_data_3.csv, etc...

I could use dbms_output in a PL/SQL block to control how many rows are output, but then how would I switch files, as spool does not seem to be accessible from PL/SQL blocks?

(Oracle 10g)

© Stack Overflow or respective owner

Related posts about sqlplus

Related posts about plsql