Spool file is empty
577178Jan 15 2009 — edited Jan 15 2009Morning everyone.
Hopefully this will be a really simple one...
I'm having problems with a test script - I am basically trying to spool the output of a cursor into a file in a specific location. Easy enough. Yet when I run the following script, the spool file created is blank. The DBMS output tab in my Toad session displays the data as I would expect, so I'm a little confused as to why the data isn't spooling into the file. I suspect I have set an incorrect sql plus parameter (or missed one), but I'm scratching my head as to what it could be (spent a while trawling Google with little joy).
Could some one possible cast their eye over the following, and maybe prod me in the right direction?? Any help greatly appreciated (not sure how to specifically format/highlight the code).
SET SERVER OUTPUT ON SIZE UNLIMITED FORMAT WRAPPED;
/
SET FEEDBACK OFF;
/
SET VERIFY OFF;
/
SET ECHO OFF;
/
SPOOL O:\NEW_SPOOL_TST3.TXT
DECLARE
CURSOR c_retail_alm is SELECT * FROM POSTCODE_MAP;
r_retail_alm c_retail_alm%ROWTYPE;
BEGIN
-- DBMS_OUTPUT.ENABLE(1000000);
OPEN c_retail_alm;
LOOP
FETCH c_retail_alm into r_retail_alm;
exit when c_retail_alm%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(r_retail_alm.reigon||'~'||r_retail_alm.postcode||'~'||r_retail_alm.county);
END LOOP;
CLOSE c_retail_alm;
END;
SPOOL OFF
/
SET VERIFY ON;
/
SET FEEDBACK ON;
/
SET ECHO ON;
/
SET SERVER OUTPUT OFF;