asked on
declare
cursor c_stores is
select a.str_no
from cr_store a
where a.opdate > '28-dec-13';
BEGIN
FOR i in c_stores
LOOP
SELECT i,tc.DATE_TIME_START
FROM calendar_table tc
where tc.date_time_start between '01-jan-14' and sysdate
and tc.date_time_start
not IN
(select ds.dob from
cr_gnditem ds
where ds.unit = i
and ds.dob between '01-jan-14' and sysdate
group by ds.dob)
order by tc.DATE_TIME_START;
end loop;
end;