The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT 1 FROM dual
WHERE EXISTS
(SELECT 1
FROM BOM_shift_dates sd, bom_shift_times sht
WHERE sd.calendar_code = sht.calendar_code
AND sd.shift_date = trunc(c_cal_date)
AND sd.shift_num = sht.shift_num
AND sd.calendar_code = c_calendar_id
AND sd.SEQ_NUM is NOT NULL
AND sht.to_time > sht.from_time);
SELECT COUNT(1)
FROM bom_Calendars
WHERE calendar_code = p_calendar_code;
SELECT calendar_start_date,
calendar_end_date
FROM bom_calendars
WHERE calendar_code = p_calendar_code;
SELECT sd.shift_date calendar_date,
sd.shift_num shift_num,
st.from_time from_time,
decode(sign(st.to_time - st.from_time),1,(st.to_time - st.from_time),0,0,((86400 - st.from_time)+ st.from_time)) duration,
st.to_time to_time
FROM bom_calendars cal,
bom_shift_dates sd,
bom_shift_times st
WHERE cal.calendar_code = c_calendar_code
AND sd.calendar_code = cal.calendar_code
AND st.calendar_code = sd.calendar_code
AND sd.shift_num = st.shift_num
AND sd.seq_num IS NOT NULL
AND (sd.shift_date + (st.from_time + decode(sign(st.to_time - st.from_time),1,(st.to_time - st.from_time),0,0,((86400 - st.from_time)+ st.from_time)))/86400) > c_start_date
ORDER BY sd.shift_date ,
st.from_time ,
st.to_time ;
SELECT sd.shift_date calendar_date,
sd.shift_num shift_num,
st.from_time from_time,
decode(sign(st.to_time - st.from_time),1,(st.to_time - st.from_time),0,0,((86400 - st.from_time)+ st.from_time)) duration,
st.to_time to_time
FROM bom_calendars cal,
bom_shift_dates sd,
bom_shift_times st
WHERE cal.calendar_code = c_calendar_code
AND sd.calendar_code = cal.calendar_code
AND st.calendar_code = sd.calendar_code
AND sd.shift_num = st.shift_num
AND sd.seq_num IS NOT NULL
AND (sd.shift_date + st.from_time/86400) < c_end_date
ORDER BY sd.shift_date DESC,
(st.from_time + decode(sign(st.to_time - st.from_time),1,(st.to_time - st.from_time),0,0,((86400 - st.from_time)+ st.from_time))) DESC,
st.from_time DESC ;
p_output_tbl.DELETE ;
p_output_tbl.DELETE ;
SELECT COUNT(1)
FROM bom_Calendars
WHERE calendar_code = c_calendar_code;
SELECT calendar_start_date ,
calendar_end_date
FROM bom_Calendars
WHERE calendar_code = c_calendar_code;
SELECT sd.shift_date calendar_date,
decode(SUM(decode(sd.seq_num,NULL,0,1)),0,0,1) l_work_day
FROM bom_calendars cal,
bom_shift_dates sd,
bom_shift_times st
WHERE cal.calendar_code = c_calendar_code
AND sd.calendar_code = cal.calendar_code
AND st.calendar_code = sd.calendar_code
AND sd.shift_date BETWEEN trunc(c_start_date) AND trunc(c_end_date)
AND sd.shift_num = st.shift_num
GROUP BY sd.shift_date
ORDER BY sd.shift_date; /*B5182025 - sowsubra - added order by clause*/
SELECT sd.shift_date calendar_date,
SUM((st.to_time - st.from_time)/3600) duration
FROM bom_calendars cal,
bom_shift_dates sd,
bom_shift_times st
WHERE cal.calendar_code = c_calendar_code
AND sd.calendar_code = cal.calendar_code
AND st.calendar_code = sd.calendar_code
AND sd.shift_date BETWEEN trunc(c_start_date) AND trunc(c_end_date)
AND sd.shift_num = st.shift_num
AND sd.seq_num IS NOT NULL
GROUP BY sd.shift_date
HAVING SUM((st.to_time - st.from_time)/3600) > 0 ;
SELECT shift_num,from_time,to_time
FROM bom_shift_times
WHERE calendar_code = c_calendar_code
AND shift_num = c_shopday_no
ORDER BY from_time ;
SELECT COUNT(*)
FROM bom_shift_times
WHERE calendar_code = c_calendar_code
AND shift_num = c_shopday_no;
SELECT COUNT(1)
FROM bom_Calendars
WHERE calendar_code = p_calendar_code;
SELECT calendar_start_date ,
calendar_end_date
FROM bom_Calendars
WHERE calendar_code = p_calendar_code;
SELECT COUNT(1)
FROM bom_Calendars
WHERE calendar_code = c_calendar_code;
SELECT 1
FROM bom_calendars cal,
bom_shift_dates sd,
bom_shift_times st
WHERE cal.calendar_code = c_calendar_code
AND sd.calendar_code = cal.calendar_code
AND st.calendar_code = sd.calendar_code
AND sd.shift_num = st.shift_num
-- B4610901, Rajesh Patangya 15-Sep-2005
AND (sd.shift_date + (st.from_time/86400)) <= c_cal_date
AND DECODE(
SIGN(st.from_time - st.to_time),
1,(sd.shift_date+1), sd.shift_date
) + (st.to_time/86400) >= c_cal_date
AND sd.seq_num IS NOT NULL;
SELECT 1
FROM sys.dual
WHERE EXISTS (
select 'x'
FROM bom_calendars bd,
bom_shift_dates sd,
bom_shift_times st
WHERE bd.calendar_code = p_calendar_id
AND sd.calendar_code = bd.calendar_code
AND sd.calendar_code= st.calendar_code
AND sd.shift_num = st.shift_num
AND (sd.shift_date + (st.from_time/86400)) <= p_date
AND sd.seq_num IS NOT NULL
AND ((decode(sign(st.from_time + (st.to_time- st.from_time) - 86400),1,
(sd.shift_date+1),sd.shift_date) ) +
(decode(sign(st.from_time + (st.to_time- st.from_time) - 86400),1,
(st.from_time + (st.to_time- st.from_time) - 86400),
(st.from_time + (st.to_time- st.from_time)))/86400 ) ) >= p_date);
SELECT min (sd.shift_date + (st.from_time/86400))
FROM bom_calendars bd,
bom_shift_dates sd,
bom_shift_times st
WHERE bd.calendar_code = p_calendar_id
AND sd.calendar_code = bd.calendar_code
AND sd.calendar_code= st.calendar_code
AND sd.shift_num = st.shift_num
AND sd.seq_num IS NOT NULL
AND (st.to_time- st.from_time) > 0
AND (sd.shift_date + (st.from_time/86400)) > p_cal_date ;
SELECT max (
((decode(sign(st.from_time + (st.to_time- st.from_time) - 86400),1,
(sd.shift_date+1),sd.shift_date) ) +
(decode(sign(st.from_time + (st.to_time- st.from_time) - 86400),1,(st.from_time
+ (st.to_time- st.from_time) - 86400),(st.from_time + (st.to_time- st.from_time)))/86400 ) )
)
FROM bom_calendars bd,
bom_shift_dates sd,
bom_shift_times st
WHERE bd.calendar_code = p_calendar_id
AND sd.calendar_code = bd.calendar_code
AND sd.calendar_code= st.calendar_code
AND sd.shift_num = st.shift_num
AND sd.seq_num IS NOT NULL
AND (st.to_time- st.from_time) > 0
AND ((decode(sign(st.from_time + (st.to_time- st.from_time) - 86400),1,
(sd.shift_date+1),sd.shift_date) ) +
(decode(sign(st.from_time + (st.to_time- st.from_time) - 86400),1,(st.from_time
+ (st.to_time- st.from_time) - 86400),(st.from_time + (st.to_time- st.from_time)))/86400 ))
< p_date;