This content has been marked as final. Show 2 replies
Welcome to the forum!
Here's one way:
The first SPOOL file, dept.txt, looks like this:
COLUMN row_cnt_col NOPRINT NEW_VALUE row_cnt -- You may or may not want the following settings. -- The 2-file output works with or without them. SET FEEDBACK OFF SET VERIFY OFF SPOOL dept.txt SELECT deptno, dname , COUNT (*) OVER () AS row_cnt_col FROM scott.dept ; SPOOL OFF SPOOL dept.log SELECT &row_cnt AS total_rows_found FROM dual; SPOOL OFF
The second SPOOL file, dept.log, looks like this:
` DEPTNO DNAME ---------- -------------- 10 ACCOUNTING 20 RESEARCH 30 SALES 40 OPERATIONS
Using your example, only the first query has to change:
TOTAL_ROWS_FOUND ---------------- 4
The second query, and all the set-up stuff is exactly the same.
SELECT 'TEST' AS output , COUNT (*) OVER () AS row_cnt_col FROM dual ;
Edited by: Frank Kulash on Sep 27, 2012 9:38 AM
Thank you for the solution.
It is OK like this.