How to return the rowcount of a sql plus query to a separate file
<p>I am currently running a SQL PLUS script that returns all where it matches and with feedback on it writes this out at the end of the extract.csv file. However is there a quicker way to write the feedback (rows selected) on to a separate file. I have currently just wrapped a count around the query (2nd query) but surely there has to be a quicker way because this is stored on the feedback. just cant find anything online</p>

<pre><code>set embedded on
set pagesize 0
set heading on
set linesize 256
set colsep ,   
set trimspool on 
set echo off 
set feedback on 
set termout off
SET UNDERLINE off 

spool C:\extract.csv

select * from stat1 st1
INNER JOIN numbers nmb 
on st1.numb LIKE '%' || nmb.numb || '%';

spool off 

spool C:\count.csv

select count(*) from (select * from stat1 st1
INNER JOIN numbers nmb 
on st1.numb LIKE '%' || nmb.numb || '%');

quit; 
</code></pre>