The following lines contain the word 'select', 'insert', 'update' or 'delete':
select count(*) into workday_pattern
from BOM_WORKDAY_PATTERNS
where calendar_code = x_calendar_code
and shift_num is null;
select count(*) into workday_pattern from BOM_WORKDAY_PATTERNS
where calendar_code = x_calendar_code
and shift_num = x_shift_num;
select 1 into dummy from DUAL where not exists
(select 1 from BOM_CALENDARS
where calendar_code = x_calendar_code
);
select max(exception_date) into cal_except_date
from BOM_CALENDAR_EXCEPTIONS
where calendar_code = x_calendar_code;
select max(exception_date) into shift_except_date
from BOM_SHIFT_EXCEPTIONS
where calendar_code = x_calendar_code;
select min(exception_date) into cal_except_date
from BOM_CALENDAR_EXCEPTIONS
where calendar_code = x_calendar_code;
select min(exception_date) into shift_except_date
from BOM_SHIFT_EXCEPTIONS
where calendar_code = x_calendar_code;
select 1 into dummy from DUAL where not exists
(select 1 from BOM_CALENDAR_EXCEPTIONS
where calendar_code = x_calendar_code
and exception_date = x_exception_date
);
select 1 into dummy from DUAL where not exists
(select 1 from BOM_CALENDAR_SHIFTS
where calendar_code = x_calendar_code
and shift_num = x_shift_num
);
select 1 into dummy from DUAL where not exists
(select 1 from BOM_SHIFT_EXCEPTIONS
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and exception_date = x_exception_date
);
select 1 into dummy from DUAL where not exists
(select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time = x_start_time
and to_time = x_end_time
and (
rowid is null
or
rowid <> x_row_id
)
);
select count(*) into dummy from dual where not exists
(select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time < to_time
and x_start_time > from_time
and x_start_time < to_time
union
select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time > to_time
and (x_start_time > from_time or x_start_time < to_time)
);
select count(*) into dummy from dual where not exists
(select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time < to_time
and x_start_time > from_time
and x_start_time < to_time
and x_rowid <> x_rowid
union
select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time > to_time
and (x_start_time > from_time or x_start_time < to_time)
and x_rowid <> x_rowid
);
select count(*) into dummy from DUAL where not exists
(select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time < to_time
and x_end_time > from_time
and x_end_time < to_time
union
select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time > to_time
and (x_end_time < to_time or x_end_time > from_time)
);
select count(*) into dummy from DUAL where not exists
(select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time < to_time
and x_end_time > from_time
and x_end_time < to_time
and rowid <> x_rowid
union
select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time > to_time
and (x_end_time < to_time or x_end_time > from_time)
and rowid <> x_rowid
);
select count(*) into dummy from DUAL where not exists
(select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time < to_time
and x_start_time < x_end_time
and x_start_time < from_time
and x_end_time > to_time
union
select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time < to_time
and x_start_time < x_end_time
and x_start_time > from_time
and x_end_time < to_time
);
select count(*) into dummy from DUAL where not exists
(select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time < to_time
and x_start_time < x_end_time
and x_start_time < from_time
and x_end_time > to_time
and rowid <> x_rowid
union
select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time < to_time
and x_start_time < x_end_time
and x_start_time > from_time
and x_end_time < to_time
and rowid <> x_rowid
);
select count(*) into dummy from DUAL where not exists
(select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time > to_time
and x_start_time > x_end_time
and x_start_time < from_time
and x_end_time > to_time
union
select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time > to_time
and x_start_time > x_end_time
and x_start_time > from_time
and x_end_time < to_time
);
select count(*) into dummy from DUAL where not exists
(select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time > to_time
and x_start_time > x_end_time
and x_start_time < from_time
and x_end_time > to_time
and rowid <> x_rowid
union
select 1 from BOM_SHIFT_TIMES
where calendar_code = x_calendar_code
and shift_num = x_shift_num
and from_time > to_time
and x_start_time > x_end_time
and x_start_time > from_time
and x_end_time < to_time
and rowid <> x_rowid
);