I’ve created some SQL that will generate a view, giving a more VERBOSE description of the values in the DAY_TIMING field. You will still have to check the BEGIN_DATE and TIME (or add that SQL to this view), but this is mainly to translate the DAY_TIMING field into English.
Warning… Nasty code ahead:
create or replace view DAY_TIMING_VW as
select BATCH_ID,DAY_TIMING,frequency,
(CASE
WHEN FREQUENCY in (64,66) then
'MONTHLY on ' ||
rtrim(
decode(bitand(DAY_TIMING,power(2,31)),power(2,31),'1,',null) ||
decode(bitand(DAY_TIMING,power(2,30)),power(2,30),'2,',null) ||
decode(bitand(DAY_TIMING,power(2,29)),power(2,29),'3,',null) ||
decode(bitand(DAY_TIMING,power(2,28)),power(2,28),'4,',null) ||
decode(bitand(DAY_TIMING,power(2,27)),power(2,27),'5,',null) ||
decode(bitand(DAY_TIMING,power(2,26)),power(2,26),'6,',null) ||
decode(bitand(DAY_TIMING,power(2,25)),power(2,25),'7,',null) ||
decode(bitand(DAY_TIMING,power(2,24)),power(2,24),'8,',null) ||
decode(bitand(DAY_TIMING,power(2,23)),power(2,23),'9,',null) ||
decode(bitand(DAY_TIMING,power(2,22)),power(2,22),'10,',null) ||
decode(bitand(DAY_TIMING,power(2,21)),power(2,21),'11,',null) ||
decode(bitand(DAY_TIMING,power(2,20)),power(2,20),'12,',null) ||
decode(bitand(DAY_TIMING,power(2,19)),power(2,19),'13,',null) ||
decode(bitand(DAY_TIMING,power(2,18)),power(2,18),'14,',null) ||
decode(bitand(DAY_TIMING,power(2,17)),power(2,17),'15,',null) ||
decode(bitand(DAY_TIMING,power(2,16)),power(2,16),'16,',null) ||
decode(bitand(DAY_TIMING,power(2,15)),power(2,15),'17,',null) ||
decode(bitand(DAY_TIMING,power(2,14)),power(2,14),'18,',null) ||
decode(bitand(DAY_TIMING,power(2,13)),power(2,13),'19,',null) ||
decode(bitand(DAY_TIMING,power(2,12)),power(2,12),'20,',null) ||
decode(bitand(DAY_TIMING,power(2,11)),power(2,11),'21,',null) ||
decode(bitand(DAY_TIMING,power(2,10)),power(2,10),'22,',null) ||
decode(bitand(DAY_TIMING,power(2,9)),power(2,9),'23,',null) ||
decode(bitand(DAY_TIMING,power(2,8)),power(2,8),'24,',null) ||
decode(bitand(DAY_TIMING,power(2,7)),power(2,7),'25,',null) ||
decode(bitand(DAY_TIMING,power(2,6)),power(2,6),'26,',null) ||
decode(bitand(DAY_TIMING,power(2,5)),power(2,5),'27,',null) ||
decode(bitand(DAY_TIMING,power(2,4)),power(2,4),'28,',null) ||
decode(bitand(DAY_TIMING,power(2,3)),power(2,3),'29,',null) ||
decode(bitand(DAY_TIMING,power(2,2)),power(2,2),'30,',null) ||
decode(bitand(DAY_TIMING,power(2,1)),power(2,1),'31,',null) ||
decode(bitand(DAY_TIMING,power(2,0)),power(2,0),'LAST,',null) ,',')
WHEN FREQUENCY in (8,10) then 'HOURLY' ||
(CASE WHEN DAY_TIMING <24 then ' at ' || DAY_TIMING
WHEN instr(DAY_TIMING,'0',1,3) > 0 then
' between ' || substr(DAY_TIMING,1,instr(DAY_TIMING,'0',1,2)-1) || ' and ' || substr(DAY_TIMING,instr(DAY_TIMING,'0',1,2)+1)
WHEN instr(DAY_TIMING,'0',1,2) = length(DAY_TIMING) then
' between ' || substr(DAY_TIMING,1,instr(DAY_TIMING,'0',1,1)-1) || ' and ' || substr(DAY_TIMING,instr(DAY_TIMING,'0',1,1)+1)
WHEN instr(DAY_TIMING,'0',1,2) > 0 then
' between ' || substr(DAY_TIMING,1,instr(DAY_TIMING,'0',1,2)-1) || ' and ' || substr(DAY_TIMING,instr(DAY_TIMING,'0',1,2)+1)
ELSE
' between ' || substr(DAY_TIMING,1,instr(DAY_TIMING,'0',1)-1) || ' and ' || substr(DAY_TIMING,instr(DAY_TIMING,'0',1)+1)
END)
WHEN FREQUENCY in (16,18) then 'DAILY every ' ||
( decode(bitand(DAY_TIMING,power(2,21)),power(2,21),1,0) +
decode(bitand(DAY_TIMING,power(2,22)),power(2,22),2,0) +
decode(bitand(DAY_TIMING,power(2,23)),power(2,23),4,0) +
decode(bitand(DAY_TIMING,power(2,24)),power(2,24),8,0) +
decode(bitand(DAY_TIMING,power(2,25)),power(2,25),16,0) +
decode(bitand(DAY_TIMING,power(2,26)),power(2,26),32,0) +
decode(bitand(DAY_TIMING,power(2,27)),power(2,27),64,0)) || ' week(s) on ' ||
rtrim(
decode(bitand(DAY_TIMING,power(2,3)),power(2,3),'MON,',null) ||
decode(bitand(DAY_TIMING,power(2,4)),power(2,4),'TUE,',null) ||
decode(bitand(DAY_TIMING,power(2,5)),power(2,5),'WED,',null) ||
decode(bitand(DAY_TIMING,power(2,6)),power(2,6),'THU,',null) ||
decode(bitand(DAY_TIMING,power(2,7)),power(2,7),'FRI,',null) ||
decode(bitand(DAY_TIMING,power(2,8)),power(2,8),'SAT,',null) ||
decode(bitand(DAY_TIMING,power(2,9)),power(2,9),'SUN,',null)
,',')
WHEN FREQUENCY in (32,34) then 'WEEKLY every ' ||
( decode(bitand(DAY_TIMING,power(2,21)),power(2,21),1,0) +
decode(bitand(DAY_TIMING,power(2,22)),power(2,22),2,0) +
decode(bitand(DAY_TIMING,power(2,23)),power(2,23),4,0) +
decode(bitand(DAY_TIMING,power(2,24)),power(2,24),8,0) +
decode(bitand(DAY_TIMING,power(2,25)),power(2,25),16,0) +
decode(bitand(DAY_TIMING,power(2,26)),power(2,26),32,0) +
decode(bitand(DAY_TIMING,power(2,27)),power(2,27),64,0)) || ' week(s) on ' ||
rtrim(
decode(bitand(DAY_TIMING,power(2,3)),power(2,3),'MON,',null) ||
decode(bitand(DAY_TIMING,power(2,4)),power(2,4),'TUE,',null) ||
decode(bitand(DAY_TIMING,power(2,5)),power(2,5),'WED,',null) ||
decode(bitand(DAY_TIMING,power(2,6)),power(2,6),'THU,',null) ||
decode(bitand(DAY_TIMING,power(2,7)),power(2,7),'FRI,',null) ||
decode(bitand(DAY_TIMING,power(2,8)),power(2,8),'SAT,',null) ||
decode(bitand(DAY_TIMING,power(2,9)),power(2,9),'SUN,',null)
,',')
WHEN FREQUENCY in (128,130) then 'MONTHLY INTERVAL every ' ||
( decode(bitand(DAY_TIMING,power(2,21)),power(2,21),1,0) +
decode(bitand(DAY_TIMING,power(2,22)),power(2,22),2,0) +
decode(bitand(DAY_TIMING,power(2,23)),power(2,23),4,0) +
decode(bitand(DAY_TIMING,power(2,24)),power(2,24),8,0) +
decode(bitand(DAY_TIMING,power(2,25)),power(2,25),16,0) +
decode(bitand(DAY_TIMING,power(2,26)),power(2,26),32,0) +
decode(bitand(DAY_TIMING,power(2,27)),power(2,27),64,0)) || ' ' ||
rtrim(
decode(bitand(DAY_TIMING,power(2,13)),power(2,13),'1st,',null) ||
decode(bitand(DAY_TIMING,power(2,14)),power(2,14),'2nd,',null) ||
decode(bitand(DAY_TIMING,power(2,15)),power(2,15),'3rd,',null) ||
decode(bitand(DAY_TIMING,power(2,16)),power(2,16),'4th,',null) ||
decode(bitand(DAY_TIMING,power(2,17)),power(2,17),'Last,',null)
,',') || ' ' ||
rtrim(
decode(bitand(DAY_TIMING,power(2,3)),power(2,3),'MON,',null) ||
decode(bitand(DAY_TIMING,power(2,4)),power(2,4),'TUE,',null) ||
decode(bitand(DAY_TIMING,power(2,5)),power(2,5),'WED,',null) ||
decode(bitand(DAY_TIMING,power(2,6)),power(2,6),'THU,',null) ||
decode(bitand(DAY_TIMING,power(2,7)),power(2,7),'FRI,',null) ||
decode(bitand(DAY_TIMING,power(2,8)),power(2,8),'SAT,',null) ||
decode(bitand(DAY_TIMING,power(2,9)),power(2,9),'SUN,',null) ||
decode(bitand(DAY_TIMING,power(2,10)),power(2,10),'WEEKDAY,',null) ||
decode(bitand(DAY_TIMING,power(2,11)),power(2,11),'DAY,',null) ||
decode(bitand(DAY_TIMING,power(2,12)),power(2,12),'BUSINESS DAY,',null)
,',')
END) as TIMING_DESC
from DS_PENDING_JOB;
digpen (BOB member since 2002-08-15)