I have a SQL script
select fh.box_name
from file_update_history fh,update_file_vw ff
WHERE
ff.file_id=fh.file_id
and fh.act_record_count IS NULL
AND FF.STATUS_CD <> 'OLD'
and to_char(fh.access_date,'YYYYMMDD') between to_char(SYSDATE, 'YYYYMMDD') and to_char(SYSDATE+1, 'YYYYMMDD')
order by fh.exp_arr_time_update_file,FF.FILE_NAME;
I need to get/spool the output of this SQL into a flat file. Which should have the query output. I am not getting the output of the query into the file.
I have used
sqlplus /NOLOG <<My_DB > $DB_OUTPUT_FILE
set feedback on;
set term on;
set echo on;
set heading off;
set underline off;
set pagesize 10000;
set linesize 999;
set wrap off;
WHENEVER SQLERROR EXIT 20;
connect ${My_DB_USER}/${My_DB_PASSWORD} ;
select fh.box_name
from file_update_history fh,update_file_vw ff
WHERE
ff.file_id=fh.file_id
and fh.act_record_count IS NULL
AND FF.STATUS_CD <> 'OLD'
and to_char(fh.access_date,'YYYYMMDD') between to_char(SYSDATE, 'YYYYMMDD') and to_char(SYSDATE+1, 'YYYYMMDD')
order by fh.exp_arr_time_update_file,FF.FILE_NAME;
exit
My_DB
fh.access_date. You can get the same result withand fh.access_date between trunc(SYSDATE) and trunc(SYSDATE + 1).