The following lines contain the word 'select', 'insert', 'update' or 'delete':
RETURN '( select start_date, end_date, end_date report_date, to_char(end_date,''dd-Mon-yy'') name, ordinal from rolling_cal where 1=1 ' ||
case
when p_include_prior = 'Y' and
p_include_opening = 'Y' then
''
when p_include_prior = 'Y' then
--'and current_ind in (1,2)'
' and ( bitand(current_ind_sum,1) = 1 OR
bitand(current_ind_sum,2) = 2) '
when p_include_opening = 'Y' then
---'and current_ind in (1,4)'
' and ( bitand(current_ind_sum,1) = 1 OR
bitand(current_ind_sum,4) = 4)'
else
'and bitand(current_ind_sum,1) = 1'
end
|| ')' ;
return '( select start_date, end_date, end_date report_date, to_char(end_date,''dd-Mon-yy'') name, ordinal from '
|| '( select distinct '
|| 'decode(t.current_ind, 2, &BIS_PREVIOUS_EFFECTIVE_END_DATE'
|| ', 4, (&BIS_CURRENT_EFFECTIVE_START_DATE - 1)'
|| ', &BIS_CURRENT_EFFECTIVE_END_DATE)+(t.offset*&RLX_DAYS) '
|| '- &RLX_DAYS_TO_START start_date'
|| ', decode(t.current_ind, 2, &BIS_PREVIOUS_EFFECTIVE_END_DATE'
|| ', 4, (&BIS_CURRENT_EFFECTIVE_START_DATE - 1)'
|| ', &BIS_CURRENT_EFFECTIVE_END_DATE)+(t.offset*&RLX_DAYS) end_date'
|| ', decode(&BIS_TIME_COMPARISON_TYPE,''SEQUENTIAL'',-1,decode(t.current_ind,4,0,2,1,2)) ordinal '
|| 'from biv_trend_rpt t '
|| 'where t.offset > &RLX_ROWS_OFFSET '
|| case
when p_include_prior = 'Y' and
p_include_opening = 'Y' then
''
when p_include_prior = 'Y' then
'and current_ind in (1,2)'
when p_include_opening = 'Y' then
'and current_ind in (1,4)'
else
'and current_ind = 1'
end
|| ' )'
|| ' )';
l_table_name := '(select fnd_date.date_to_displaydate(report_date) name, t.report_date start_date, t.report_date end_date from fii_time_day t)';
' fact.commodity_id in (select commodity_id
from po_commodity_grants sec,
fnd_menus menu
where sec.person_id = &FND_EMPLOYEE_ID and
menu.menu_name = ''PO_COMMODITY_MANAGER'' and
sec.menu_id = menu.menu_id)';
(select sec.commodity_id
from po_commodity_grants sec,
fnd_menus menu
where sec.person_id = &FND_EMPLOYEE_ID
and menu.menu_name = ''PO_COMMODITY_MANAGER''
and sec.menu_id = menu.menu_id) ';
(select orgl.organization_id
from per_organization_list orgl,
hr_organization_information orgi
where orgi.org_information1 = ''OPERATING_UNIT''
and orgl.organization_id = orgi.organization_id
and orgl.security_profile_id = &SEC_ID ) ';
and exists (select 1
from per_organization_list orgl
where fact.org_id = orgl.organization_id
and orgl.security_profile_id = ';
' and exists(select 1 from ak_web_user_sec_attr_values
isp, fnd_application appl
where
isp.web_user_id = &FND_USER_ID
and isp.number_value = fact.supplier_id
and isp.attribute_application_id = appl.application_id
and appl.application_short_name = ''POS'') ';
return ' ( with rolling_cal as ( select start_date, end_date, end_date report_date, to_char(end_date,''dd-Mon-yy'') name, ordinal, current_ind_sum from '
|| '( select '
|| 'decode(t.current_ind, 2, &BIS_PREVIOUS_EFFECTIVE_END_DATE'
|| ', 4, (&BIS_CURRENT_EFFECTIVE_START_DATE - 1)'
|| ', &BIS_CURRENT_EFFECTIVE_END_DATE)+(t.offset*&RLX_DAYS) '
|| '- &RLX_DAYS_TO_START start_date'
|| ', decode(t.current_ind, 2, &BIS_PREVIOUS_EFFECTIVE_END_DATE'
|| ', 4, (&BIS_CURRENT_EFFECTIVE_START_DATE - 1)'
|| ', &BIS_CURRENT_EFFECTIVE_END_DATE)+(t.offset*&RLX_DAYS) end_date'
|| ', decode(&BIS_TIME_COMPARISON_TYPE,''SEQUENTIAL'',-1,decode(t.current_ind,4,0,2,1,2)) ordinal , SUM(current_ind) current_ind_sum '
|| 'from biv_trend_rpt t '
|| 'where t.offset > &RLX_ROWS_OFFSET '
|| 'group by decode(t.current_ind, 2, &BIS_PREVIOUS_EFFECTIVE_END_DATE'
|| ', 4, (&BIS_CURRENT_EFFECTIVE_START_DATE - 1)'
|| ', &BIS_CURRENT_EFFECTIVE_END_DATE)+(t.offset*&RLX_DAYS) '
|| '- &RLX_DAYS_TO_START '
|| ', decode(t.current_ind, 2, &BIS_PREVIOUS_EFFECTIVE_END_DATE'
|| ', 4, (&BIS_CURRENT_EFFECTIVE_START_DATE - 1)'
|| ', &BIS_CURRENT_EFFECTIVE_END_DATE)+(t.offset*&RLX_DAYS) '
|| ', decode(&BIS_TIME_COMPARISON_TYPE,''SEQUENTIAL'',-1,decode(t.current_ind,4,0,2,1,2)) '
|| ' )'
|| ' )';