Может кому-то нужно, накидал тут... Суть - проверка, что за последние сутки загрузилось тоже самое, что грузилось всю неделю.
Код:
set linesize 1000
SET LINESIZE 1200
SET PAGESIZE 0
SET FEEDBACK OFF
SET ECHO OFF
SET VERIFY OFF
SET PAUSE OFF
SET TRIMSPOOL OFF
spool C:\wow222.txt
select 'Недозагруженные кассы по МХ на '||to_char(sysdate,'DD-MM-YYYY HH24:MI') from dual;
select l.name from (select distinct locationfrom from smdocuments
where doctype='CS' and createdat between trunc(sysdate-7) and trunc(sysdate-1)
minus
select * from (
select distinct locationfrom from smdocuments
where doctype='CS' and createdat >= trunc(sysdate-1)
minus
select locid from
(select distinct locid,desknum from smcashz
where closedate between trunc(sysdate-7) and trunc(sysdate-1)
minus
select distinct locid,desknum from smcashz
where closedate >= trunc(sysdate-1)))) i, smstorelocations l where i.locationfrom=l.id
order by 1;
spool off
exit