Few years ago someone created a script to set the condition where an email only gets sent on a Thursday of the week we get paid (which is every other week). It's been working for a few years but suddenly stopped in January. I'm guessing it has something to do with it being a leap year, but this sql is way over my head to know for sure. Can someone look at it and tell me if it's set up correctly? Today, Thursday 2-4-16, it was supposed to fire, but did not. I'm sure it's a matter of changing one number but, by the time I figure it out (trial and error guessing), it will be next year.
select decode(nvl((select trim(to_char(sysdate,'DAY'))
FROM dual
where mod(to_char(sysdate,'IW'),2)=0
and
(trim(to_char(sysdate,'DAY'))='THURSDAY' or
trim(to_char(sysdate,'DAY'))='THURSDAY')),0), 'THURSDAY',1,0)from dual
select decode(nvl((select trim(to_char(sysdate,'DAY'))
FROM dual
where mod(to_char(sysdate,'IW'),2)=0
and
(trim(to_char(sysdate,'DAY'))='THURSDAY' or
trim(to_char(sysdate,'DAY'))='THURSDAY')),0), 'THURSDAY',1,0)from dual