The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT *
INTO param
FROM mrp_parameters
WHERE organization_id = arg_org_id;
mrp_calendar.select_calendar_defaults(
arg_org_id,
var_calendar_code,
var_exception_set_id);
SELECT MAX(calendar_date)
INTO var_max_date
FROM bom_calendar_dates
WHERE calendar_code = var_calendar_code
AND exception_set_id = var_exception_set_id
AND seq_num IS NOT NULL;
DELETE FROM mrp_repetitive_periods
WHERE organization_id = arg_org_id;
SELECT next_date
INTO var_curr_workday
FROM bom_calendar_dates
WHERE calendar_code = var_calendar_code
AND exception_set_id = var_exception_set_id
AND calendar_date = var_curr_date;
INSERT INTO mrp_repetitive_periods
(
period_start_date,
organization_id,
last_update_date,
last_updated_by,
creation_date,
created_by,
last_update_login
)
VALUES
(
var_curr_workday,
arg_org_id,
SYSDATE,
arg_user_id,
SYSDATE,
arg_user_id,
-1
);
UPDATE mrp_repetitive_periods s
SET period_start_date =
(SELECT next_date
FROM bom_calendar_dates
WHERE calendar_code = var_calendar_code
AND exception_set_id = var_exception_set_id
AND calendar_date = s.period_start_date)
WHERE EXISTS
(SELECT NULL
FROM bom_calendar_dates d
WHERE NOT EXISTS
(SELECT NULL
FROM mrp_repetitive_periods
WHERE organization_id = s.organization_id
AND period_start_date = d.next_date)
AND seq_num IS NULL
AND calendar_code = var_calendar_code
AND exception_set_id = var_exception_set_id
AND calendar_date = s.period_start_date)
AND organization_id = arg_org_id;
DELETE FROM mrp_repetitive_periods s
WHERE organization_id = arg_org_id
AND EXISTS
(SELECT NULL
FROM bom_calendar_dates d
WHERE seq_num IS NULL
AND calendar_code = var_calendar_code
AND exception_set_id = var_exception_set_id
AND calendar_date = s.period_start_date);