The following lines contain the word 'select', 'insert', 'update' or 'delete':
select instance,
calendar_code,
calendar_type,
min(day) min_day,
max(day) max_day
from msd_st_time
where instance <> '0'
group by instance, calendar_code, calendar_type;
Delete from msd_st_time
where instance = Calendar_Rec.instance
and calendar_code = Calendar_Rec.calendar_code
and calendar_type = Calendar_Rec.calendar_type
and day between Calendar_Rec.min_day and Calendar_Rec.max_day ;