The following lines contain the word 'select', 'insert', 'update' or 'delete':
(SELECT 1
FROM org_access o
WHERE o.responsibility_id = fnd_global.resp_id
AND o.resp_application_id = fnd_global.resp_appl_id
AND o.organization_id = fact.inv_org_id)
OR EXISTS
(SELECT 1
FROM mtl_parameters org
WHERE org.organization_id = fact.inv_org_id
AND NOT EXISTS
(SELECT 1
FROM org_access ora
WHERE org.organization_id = ora.organization_id)))';
SELECT fii.name VIEWBY,
s.scheduled_days
/ decode(s.booked_line_cnt, 0, NULL,
s.booked_line_cnt) ISC_MEASURE_1, -- avg scheduled days
s.requested_days
/ decode(s.booked_line_cnt, 0, NULL,
s.booked_line_cnt) ISC_MEASURE_2, -- avg requested days
s.scheduled_days
/ decode(s.booked_line_cnt, 0, NULL,
s.booked_line_cnt) -
s.requested_days
/ decode(s.booked_line_cnt, 0, NULL,
s.booked_line_cnt) ISC_MEASURE_3 -- deviation
FROM (SELECT fii.start_date START_DATE,
sum(nvl(fact.scheduled_days, 0)) SCHEDULED_DAYS,
sum(nvl(fact.requested_days, 0)) REQUESTED_DAYS,
sum(nvl(fact.booked_line_cnt, 0)) BOOKED_LINE_CNT
FROM '||l_mv||' fact,
'||l_period_type||' fii,
FII_TIME_RPT_STRUCT_V cal'||l_prod_cat_from||'
WHERE fii.start_date BETWEEN &BIS_CURRENT_REPORT_START_DATE
AND &BIS_CURRENT_ASOF_DATE
AND cal.report_date = least(fii.end_date, &BIS_CURRENT_ASOF_DATE)
AND fact.time_id = cal.time_id
AND fact.period_type_id = cal.period_type_id'||l_flags_where||'
AND bitand(cal.record_type_id, &BIS_NESTED_PATTERN) = cal.record_type_id'
||l_inv_org_where
||l_prod_cat_where
||l_prod_where
||l_cust_where||'
GROUP BY fii.start_date) s,
'||l_period_type||' fii
WHERE fii.start_date BETWEEN &BIS_CURRENT_REPORT_START_DATE
AND &BIS_CURRENT_ASOF_DATE
AND fii.start_date = s.start_date(+)
ORDER BY fii.start_date';