0
下面是我編寫的用於生成報告的SQL查詢,它在服務器中發送,因此每天都會執行此查詢。但是在從自動收到來自系統的自動電子郵件的時候,日期是第一次自動化報告數據是空的每個月。ORACLE數據庫報告問題
請幫我解決這個問題。
set serveroutput on
clear screen
set feedback off
set verify off
spool d:\STO_AC_HCIN.txt
--spool /u14/manjula/STO_AC_HCIN.txt
set pagesize 1500
set linesize 150
column ff NOPRINT NEW_VALUE CURR_date
column gg NOPRINT NEW_VALUE CURR_time
column InvDate heading 'Inv_Date' FORMAT date
column Qty heading 'Qty' FORMAT 999999999
select to_char(sysdate, 'DD-MON-YYYY') ff,
to_char(sysdate, 'HH24:MI') gg
from dual;
TTITLE LEFT COL 25 'BILL CHECK STO AC HCIN ' skip 1 -
LEFT COL 25 'LOGIWIZ LIMITED-DLx/M WMS' skip 2 -
'Report Date : ' CURR_DATE skip 1 -
'Time : ' CURR_TIME skip 3 -
select to_char(trunc(p.ext_date),'DD/MM/YYYY') InvDate,
count(distinct (substr(p.loc,1,12))) +7 Qty -- Exclude sublocations
from prodloc_snap p,
sku s
where p.prod_no=s.prod_no
and s.comp_code='HC'
and s.prod_fam='HCIN'
and substr(p.loc,1,3) in ('R04','R06') -- Include only the AC racks
and s.sku not like '%TEST%'
and to_char(trunc(p.ext_date),'MONYY') in
(select to_char(sysdate-1,'MONYY') from dual)
--and to_char(trunc(p.ext_date),'MONYY')in (select to_char(sysdate,'MONYY') from dual)
group by to_char(trunc(p.ext_date),'DD/MM/YYYY')
repfooter skip 3 -
left col 25 '********* End Of Report ***********'
/
set feedback on
spool off
ttitle off
repfooter off