I have below select query for which the result of this query i want to create insert scripts and saved it in files. I have used spool.
set long 10000
set lines 100000
set sqlformat insert
select ID,NAME,TEST_DATE from TEST_GRP sd
where TEST_DATE =
( select min(TEST_DATE)
from TEST_GRP sd2
where sd.ID = sd2.ID
and sd.TEST_DATE <> TO_DATE ('01.01.2000', 'dd.mm.yyyy');
We don't have access to your table or your data.
But here it is working with the demo schema HR and its EMPLOYEES table
set sqlformat insert spool c:\users\jdsmith\desktop\SO_inserts.sql select * from employees; spool off
You're using SET LONG - does your table have LOBS in it?
Also, I noticed you asked this same question on the OTN Forums...