The following lines contain the word 'select', 'insert', 'update' or 'delete':
/* The following cursor selects legal entity information related to a
business group*/
cursor business_c is
select xlep.legal_entity_id,
xlep.party_id
from hr_legal_entities hrle,
xle_entity_profiles xlep
where business_group_id = l_business_group_id
and xlep.legal_entity_id = hrle.organization_id;
select legal_entity_id
into l_legal_entity_id
from xle_entity_profiles
where party_id = p_party_id;
select party_id
into l_party_id
from xle_entity_profiles
where legal_entity_id = l_legal_entity_id;
/* Select business group information into placeholder variables
for the given Legal Entity information */
BEGIN
select business_group_id
into l_business_group_id
from hr_legal_entities
where organization_id = l_legal_entity_id;
select party_id
into l_party_id
from xle_entity_profiles
where legal_entity_id = p_LegalEntity_ID;
select legal_entity_id
into l_legal_entity_id
from xle_entity_profiles
where party_id = p_party_id;
/* The following cursor selects operating unit information associated
with a Ledger */
cursor OperUnit_c is
SELECT o.organization_id operating_unit_id
FROM hr_all_organization_units o,
hr_organization_information o2,
hr_organization_information o3
WHERE o.organization_id = o2.organization_id
AND o.organization_id = o3.organization_id
AND o2.org_information_context || '' = 'CLASS'
AND o3.org_information_context = 'Operating Unit Information'
AND o2.org_information1 = 'OPERATING_UNIT'
AND o2.org_information2 = 'Y'
AND o3.org_information3 = l_str_ledger_id;
/* Select ledger associated with the Operating unit*/
SELECT DISTINCT o3.org_information3
INTO l_ledger_id
FROM hr_all_organization_units o,
hr_organization_information o2,
hr_organization_information o3
WHERE o.organization_id = o2.organization_id
AND o.organization_id = o3.organization_id
AND o3.organization_id = o2.organization_id
AND o2.org_information_context || '' = 'CLASS'
AND o3.org_information_context = 'Operating Unit Information'
AND o2.org_information1 = 'OPERATING_UNIT'
AND o2.org_information2 = 'Y'
AND o.organization_id = p_operating_unit;
select legal_entity_id
into l_legal_entity_id
from xle_entity_profiles
where party_id = p_party_id;
select legal_entity_id
into l_legal_entity_id
from xle_entity_profiles
where party_id = p_party_id;
select to_char(l_ledger_id)
into l_str_ledger_id
from dual;
/* The following cursor selects organization information related to a legal entity*/
cursor le_c is
select organization_id
from org_organization_definitions
where legal_entity=l_Le_ID;
/* The following cursor selects legal entity information related to a organization*/
cursor org_c is
SELECT DECODE(HOI2.ORG_INFORMATION_CONTEXT, 'Accounting Information', TO_NUMBER(HOI2.ORG_INFORMATION2), null) LEGAL_ENTITY
FROM HR_ORGANIZATION_UNITS HoU,
HR_ORGANIZATION_INFORMATION HOI1,
HR_ORGANIZATION_INFORMATION HOI2
WHERE HOU.ORGANIZATION_ID = HOI1.ORGANIZATION_ID
AND HOU.ORGANIZATION_ID = HOI2.ORGANIZATION_ID
AND HOI1.ORG_INFORMATION1 = 'INV'
AND HOI1.ORG_INFORMATION2 = 'Y'
AND ( HOI1.ORG_INFORMATION_CONTEXT || '') = 'CLASS'
AND (HOI2.org_information_context || '') = 'Accounting Information'
AND (hou.organization_id)= p_InvOrg_ID;
select legal_entity_id
into l_le_id
from xle_entity_profiles
where party_id = p_party_id;
select party_id
into l_party_id
from xle_entity_profiles
where legal_entity_id = l_le_id;
SELECT o3.org_information3
INTO l_ledger_id
FROM hr_all_organization_units o,
hr_organization_information o2,
hr_organization_information o3
WHERE o.organization_id = o2.organization_id
AND o.organization_id = o3.organization_id
AND o3.organization_id = o2.organization_id
AND o2.org_information_context || '' = 'CLASS'
AND o3.org_information_context = 'Operating Unit Information'
AND o2.org_information1 = 'OPERATING_UNIT'
AND o2.org_information2 = 'Y'
AND o.organization_id = p_operating_unit_id;
SELECT application_column_name
INTO l_segment
FROM fnd_segment_attribute_values ,
gl_ledgers sob
WHERE id_flex_code = 'GL#'
AND attribute_value = 'Y'
AND segment_attribute_type = 'GL_BALANCING'
AND application_id = 101
AND sob.chart_of_accounts_id = id_flex_num
AND sob.ledger_id = l_ledger_id ;
EXECUTE IMMEDIATE ' SELECT '|| l_segment ||' FROM gl_code_combinations
WHERE code_combination_id ='|| P_code_combination_id INTO l_sel_column;
select ent.legal_entity_id
into l_le_id
from XLE_ENTITY_PROFILES ent,
XLE_REGISTRATIONS reg,
XLE_JURISDICTIONS_B jur
where reg.REGISTRATION_NUMBER = P_REGISTRATION_NUMBER
and REG.jurisdiction_id = jur.jurisdiction_id
and REG.SOURCE_ID = ent.LEGAL_ENTITY_ID
and JUR.REGISTRATION_CODE_LE = nvl(l_registration_code,jur.registration_code_le);
select etb.legal_entity_id
BULK COLLECT into l_le_tbl
from XLE_ETB_PROFILES etb,
XLE_REGISTRATIONS reg,
XLE_JURISDICTIONS_B jur
where reg.REGISTRATION_NUMBER = P_REGISTRATION_NUMBER
and REG.SOURCE_ID = etb.ESTABLISHMENT_ID
and REG.jurisdiction_id = jur.jurisdiction_id
and JUR.REGISTRATION_CODE_ETB = nvl(l_registration_code,jur.registration_code_etb)
group by etb.legal_entity_id;
l_le_tbl.DELETE;
SELECT legal_parent_id BULK COLLECT INTO l_le_tbl
FROM xle_tax_associations
WHERE ENTITY_ID =P_LOCATION_ID
-- AND context = 'TAX_CALCULATION'
AND ENTITY_TYPE ='BILL_TO_LOCATION'
AND LEGAL_CONSTRUCT = 'ESTABLISHMENT'
GROUP BY legal_parent_id;