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.prev_days_fulf
/ decode(s.prev_days_cnt, 0, NULL,
s.prev_days_cnt) ISC_MEASURE_1, -- days fulf prior
s.curr_days_fulf
/ decode(s.curr_days_cnt, 0, NULL,
s.curr_days_cnt) ISC_MEASURE_2, -- days fulf
s.curr_days_fulf
/ decode(s.curr_days_cnt, 0, NULL,
s.curr_days_cnt) -
s.prev_days_fulf
/ decode(s.prev_days_cnt, 0, NULL,
s.prev_days_cnt) ISC_MEASURE_3, -- days fulf change
NULL CURRENCY, -- obsoleted from 5.0
NULL FND_CATEGORY, -- obsoleted from 5.0
NULL FND_PRODUCT, -- obsoleted from 5.0
NULL ISC_MEASURE_4, -- obsoleted from 5.0
NULL ISC_ATTRIBUTE_2 -- obsoleted from 5.0
FROM (SELECT dates.start_date START_DATE,
sum(decode(dates.period, ''C'',
nvl(fact.book_to_fulfill_days,0), 0)) CURR_DAYS_FULF,
sum(decode(dates.period, ''P'',
nvl(fact.book_to_fulfill_days,0), 0)) PREV_DAYS_FULF,
sum(decode(dates.period, ''C'',
nvl(fact.book_to_fulfill_cnt,0), 0)) CURR_DAYS_CNT,
sum(decode(dates.period, ''P'',
nvl(fact.book_to_fulfill_cnt,0), 0)) PREV_DAYS_CNT
FROM (SELECT fii.start_date START_DATE,
''C'' PERIOD,
least(fii.end_date, &BIS_CURRENT_ASOF_DATE) REPORT_DATE
FROM '||l_period_type||' fii
WHERE fii.start_date BETWEEN &BIS_CURRENT_REPORT_START_DATE
AND &BIS_CURRENT_ASOF_DATE
UNION ALL
SELECT p2.start_date START_DATE,
''P'' PERIOD,
p1.report_date REPORT_DATE
FROM (SELECT least(fii.end_date, &BIS_PREVIOUS_ASOF_DATE) REPORT_DATE,
rownum ID
FROM '||l_period_type||' fii
WHERE fii.start_date BETWEEN &BIS_PREVIOUS_REPORT_START_DATE
AND &BIS_PREVIOUS_ASOF_DATE
ORDER BY fii.start_date DESC) p1,
(SELECT fii.start_date START_DATE,
rownum ID
FROM '||l_period_type||' fii
WHERE fii.start_date BETWEEN &BIS_CURRENT_REPORT_START_DATE
AND &BIS_CURRENT_ASOF_DATE
ORDER BY fii.start_date DESC) p2
WHERE p1.id(+) = p2.id) dates,
'||l_mv||' fact,
FII_TIME_RPT_STRUCT_V cal'||l_prod_cat_from||'
WHERE cal.report_date = dates.report_date
AND fact.time_id = cal.time_id
AND fact.period_type_id = cal.period_type_id
AND fact.return_flag = 0'||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 dates.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';