The following lines contain the word 'select', 'insert', 'update' or 'delete':
function get_ou(p_selected_org IN varchar2) return number is
l_ou number;
select decode(fpg.multi_org_flag, 'Y', to_number(hoi2.org_information3), to_number(null))
into l_ou
from hr_organization_information hoi2,
fnd_product_groups fpg
where (hoi2.org_information_context || '') = 'Accounting Information'
and organization_id = p_selected_org;
p_selected_org IN varchar2) return varchar2 is
l_f_currency_code varchar2(15);
if (p_selected_org <> 'ALL') then
select gsob.currency_code
into l_f_currency_code
from ar_system_parameters_all asp,
gl_sets_of_books gsob
where asp.org_id = p_selected_org
and asp.set_of_books_id = gsob.set_of_books_id;
select distinct gsob.currency_code
into g_common_functional_currency
from ar_system_parameters_all asp,
gl_sets_of_books gsob
where asp.set_of_books_id = gsob.set_of_books_id
and asp.org_id in (select organization_id from per_organization_list where security_profile_id = fnd_profile.value('XLA_MO_SECURITY_PROFILE_LEVEL'));
if (p_selected_org <> 'ALL') then
l_ou := get_ou(p_selected_org);
select gsob.currency_code
into l_f_currency_code
from ar_system_parameters_all asp,
gl_sets_of_books gsob
where asp.org_id = l_ou
and asp.set_of_books_id = gsob.set_of_books_id;
else -- p_selected_org = 'ALL' and functional currency
if(g_common_functional_currency is null) then
--
select multi_org_flag
into l_fnd_prod_grp_flag
from fnd_product_groups;
l_stmt := ' select distinct gsob.currency_code
into g_common_functional_currency -- if not all orgs have same func currency, will error out, return 0
from (select o.organization_id
from org_access o
where o.responsibility_id = fnd_global.resp_id
and o.resp_application_id = fnd_global.resp_appl_id
union
select org.organization_id
from mtl_parameters org
where not exists (select 1
from org_access ora
where org.organization_id = ora.organization_id))
org,
ar_system_parameters_all asp,
gl_sets_of_books gsob,
hr_organization_information hoi2
where '|| l_fnd_prod_grp_filter || ' = asp.org_id
and asp.set_of_books_id = gsob.set_of_books_id
and (hoi2.org_information_context || '') = ''Accounting Information''
and hoi2.organization_id = org.organization_id' ;
end if; -- end if p_selected_org<>'ALL'
p_selected_org IN varchar2) return varchar2 is
l_f_currency_code varchar2(15) := null;
if(upper(p_selected_org) <> 'ALL') then
l_ou := get_ou(p_selected_org);
select gsob.currency_code
into l_f_currency_code
from ar_system_parameters_all asp,
gl_sets_of_books gsob
where asp.org_id = l_ou
and asp.set_of_books_id = gsob.set_of_books_id;
p_selected_org => 'ALL');