Thanks for the question, Hatim Ali.
Asked: May 22, 2017 - 6:09 am UTC
Last updated: May 22, 2017 - 8:38 am UTC
Version: Oracle 11g
Viewed 1000+ times
You Asked
I have a requirement where i need to spool reach record into a different file
Eg.
Select * from Test_Table
Output :-
ABC
XYZ
QWE
ASD
....
and so on
So need to generate individual files which will have the output saved
File1 : ABC
File2 : XYZ
How do i generate these different files.....
and Connor said...
If you're prepared to do a second pass through table, you can do:
<code>
spool unload.sql
select
'spool '||col1||chr(10)||
'select * from test_table where col1 = '''||col1||''''||chr(10)||
'spool off'
from test_table;
spool off
@unload.sql
<code>
Is this answer out of date? If it is, please let us know via a Comment